www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/30/22:48:01

From: myknees AT aol DOT com (Myknees)
Newsgroups: comp.os.msdos.djgpp
Subject: Watching in Borland & djgpp-RHIDE
Date: 1 Dec 1997 03:26:19 GMT
Lines: 77
Message-ID: <19971201032600.WAA15792@ladder01.news.aol.com>
NNTP-Posting-Host: ladder01.news.aol.com
References: <344B8C3A DOT 96239E8F AT LSTM DOT Ruhr-UNI-Bochum DOT De>
Organization: AOL http://www.aol.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hi.  I seem to have run into another difference between Borland TurboC++ Lite
and djgpp.  I am using RHIDE1.4 as a UI.  The point of the code below was to
see how constructors pass values through parameters, stepping through the code
with F7 and watching the data members d.b1, d.b2, and d.d1.

When you use TC Lite, the watch window shows that...
d.b1: 1
d.b2: 2
d.d1: 3
...the values have been set as expected by the time the highlight gets to the
getch function in main.  

The watch window in RHIDE, however, shows that...
d.b1: not available
d.b2: not available
d.d1: 3
...yet both statements are printed to the user screen:
in base constructor
in deriv constuctor
...so both constructors are working.  When stepping through the code with F7
using TCLite, you see it step through the base constructor, but you don't when
using RHIDE.

Does anyone know what the difference is?  Here's the code I'm using:

/*----------- T.cc
only slightly modified from M. Rinehart's code 
for learning about constuctors
------------*/

#include <conio.h>

class Base
{
private:
	int b1, b2;

public:
        Base(int p1, int p2);
};


class Deriv : Base
{
private:
        int d1;

public:
	Deriv(int p1, int p2, int p3);
};

int main()
{
        clrscr();

        Deriv d(1,2,3);
        getch();

        return 0;
}

Base::Base(int p1, int p2)
{
        b1 = p1;
        b2 = p2;

        cprintf("in base constructor\n\r");
}


Deriv::Deriv(int p1, int p2, int p3):Base(p1,p2)
{
 	d1 = p3;
        cprintf("in deriv constuctor\n\r");
}

// end

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019