Mail Archives: djgpp/1997/02/03/08:44:00
In article <32F39147 DOT 6896 AT snet DOT net>, =?iso-8859-1?q?Jean-
Ga=EBl_GRICOURT?= <jean-gael DOT gricourt AT snet DOT net> writes
>Please tell me what do you think about this code ?
>
>------------------------------
>
>#include <iostream.h>
>
>class Object
>{
> private:
> int data;
> public:
> Object(int=0);
> Object(Object&);
> ShowData();
>};
>
>Object::Object(int d)
>{ data=d; }
>
>Object::Object(Object &o)
>{ data=o.data; }
Your problem is here. 'data' has been defined as a private member. So
you can only access 'data' within your current class, so when you do the
assignment 'data=o.data', DJGPP cannot 'see' the 'data' member of 'o'.
Write a wrapper function to teturn it, like:
GetData(){return Data;};
--
. ben AT flag DOT demon DOT co DOT uk / www.flag.demon.co.uk
Moo-Juice on IRC. ___ .
: _~#~_ '#####`
: 'o o` #include <sys/nearptr.h> void main(){__djgpp_ |o o| :
::| | || nearptr_enable();char *v=(char*)(__djgpp_conv | | |::
:: || entional_base+0xb8000);v[0]='M';v[1]=15;v[2]= | ::
|==- /| 'o';v[3]=15;v[4]='o';v[5]=15;v[6]='!';v[7]=15 \ -==
| | | | ;__djgpp_nearptr_disable();}; | |
-oOOo---oOOo---The---Adventures---Of---Poke---And---Moo---oOOo-oOOo--
- Raw text -