|
From: Daniel G. <sp...@ho...> - 2003-03-21 08:19:55
|
Hi all, I hope you can help.
I've inherited some code, and have a small prob. I have a base class, CBase,
and a derived class, CDerived. What I've then done is to create a third
class, CNew, and there is only one instance of this class (so the members
are all static const, and the object is derived in the header file as static
CNew NewObj. I've put
CNew& NewObj;
as a member in CBase.
Ok? Good now here is the hard bit. I currently access the members of CBase
without the scope reolution operator or by dereferencing, that is I can
write
int Var = MemberOfBase;
in the member function bodies of CDerived. I think this is because of the
constructor: it looks like
CDerived(int x, int y)
: CBase(int x, int y)
{
//...
}
My question is: How do I get the same effect using CNew? How can I do
int Var = MemberOfNew;
? I'm told that it can be achieved as the object of CNew is a reference, but
I'm puzzled as how I dereference a reference so I can write the above
instead of
int Var = NewObj.MemberOfCNew
Is that clear?
Daniel
_________________________________________________________________
Surf together with new Shared Browsing
http://join.msn.com/?page=features/browse&pgmarket=en-gb&XAPID=74&DI=1059
|