Click here to Skip to main content
15,921,716 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralBaisc Pointer Question Pin
Anonymous10-Dec-04 6:18
Anonymous10-Dec-04 6:18 
GeneralRe: Baisc Pointer Question Pin
Maximilien10-Dec-04 6:40
Maximilien10-Dec-04 6:40 
GeneralRe: Baisc Pointer Question Pin
Anonymous10-Dec-04 6:51
Anonymous10-Dec-04 6:51 
GeneralRe: Baisc Pointer Question Pin
John M. Drescher10-Dec-04 9:56
John M. Drescher10-Dec-04 9:56 
GeneralRe: Baisc Pointer Question Pin
moredip10-Dec-04 7:06
moredip10-Dec-04 7:06 
GeneralRe: Baisc Pointer Question Pin
Maximilien10-Dec-04 7:33
Maximilien10-Dec-04 7:33 
GeneralRe: Baisc Pointer Question Pin
Anonymous10-Dec-04 8:06
Anonymous10-Dec-04 8:06 
GeneralRe: Baisc Pointer Question Pin
moredip10-Dec-04 8:25
moredip10-Dec-04 8:25 
You know, you really should join up and sign in if you want people to help you out Smile | :) Membership is the key...

Anyway, something along these lines might point you in the right direction:

class CFirst
{
...
...
public:
int &GetReferenceToA()
{ return a; }
...
...
}

class CSecond
{
public:
class CSecond( int &numberToAttachTo )
: b( numberToAttachTo )
{}

protected:
int &b;
};

int main()
{
CFirst instanceOfFirst;
CSecond instanceOfSecond( instanceOfFirst.GetReferenceToA() );
...
...
}


I don't know how much that helps. There would be quite a few ways of initializing the 'connection' between a and b.

One thing to note is that any member variables of CSecond() that are references MUST be initailized at construction time. This makes them more fiddly to use than pointers, IMHO.

HTH,

Pete
GeneralRe: Baisc Pointer Question Pin
Maximilien10-Dec-04 9:01
Maximilien10-Dec-04 9:01 
GeneralRe: Baisc Pointer Question Pin
poiut10-Dec-04 9:29
poiut10-Dec-04 9:29 
GeneralRe: Baisc Pointer Question Pin
Antti Keskinen10-Dec-04 10:52
Antti Keskinen10-Dec-04 10:52 
GeneralRe: Baisc Pointer Question Pin
John R. Shaw10-Dec-04 20:02
John R. Shaw10-Dec-04 20:02 
Questioncan we create a rich colored icon for VC? Pin
includeh1010-Dec-04 6:17
includeh1010-Dec-04 6:17 
AnswerRe: can we create a rich colored icon for VC? Pin
G. Steudtel10-Dec-04 7:24
G. Steudtel10-Dec-04 7:24 
GeneralCustomized Common Dialog Pin
mayoung10-Dec-04 6:04
mayoung10-Dec-04 6:04 
GeneralRe: Customized Common Dialog Pin
Jim Crafton10-Dec-04 6:36
Jim Crafton10-Dec-04 6:36 
GeneralRe: Customized Common Dialog Pin
mayoung10-Dec-04 6:49
mayoung10-Dec-04 6:49 
GeneralRe: Customized Common Dialog Pin
bolivar12314-Dec-04 7:23
bolivar12314-Dec-04 7:23 
GeneralRe: Customized Common Dialog Pin
mayoung16-Dec-04 5:11
mayoung16-Dec-04 5:11 
GeneralRe: Customized Common Dialog Pin
mayoung16-Dec-04 6:11
mayoung16-Dec-04 6:11 
GeneralRe: Customized Common Dialog Pin
bolivar12316-Dec-04 9:25
bolivar12316-Dec-04 9:25 
GeneralRe: Customized Common Dialog Pin
mayoung16-Dec-04 10:54
mayoung16-Dec-04 10:54 
GeneralProblems with app icon and TaskManager Pin
Jim Crafton10-Dec-04 5:47
Jim Crafton10-Dec-04 5:47 
GeneralWarnings C4663, C4018, C4100 Pin
Robert Valentino10-Dec-04 5:03
Robert Valentino10-Dec-04 5:03 
GeneralRe: Warnings C4663, C4018, C4100 Pin
Antti Keskinen10-Dec-04 5:42
Antti Keskinen10-Dec-04 5:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.