Click here to Skip to main content
16,004,761 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: DLL header hiding question... Pin
lzzqqq5-Jan-05 20:11
lzzqqq5-Jan-05 20:11 
GeneralEmbedded dialog hoards messages (MFC) Pin
Alex McMorris5-Jan-05 10:53
Alex McMorris5-Jan-05 10:53 
GeneralWindows Socket DLL Pin
RedDragon2k5-Jan-05 9:59
RedDragon2k5-Jan-05 9:59 
GeneralDocument Pin
act_x5-Jan-05 9:43
act_x5-Jan-05 9:43 
GeneralSending string (text or array of character) trough a socket-connection. Pin
SimCom5-Jan-05 9:22
SimCom5-Jan-05 9:22 
GeneralRe: Sending string (text or array of character) trough a socket-connection. Pin
Ravi Bhavnani5-Jan-05 10:13
professionalRavi Bhavnani5-Jan-05 10:13 
GeneralRe: Sending string (text or array of character) trough a socket-connection. Pin
SimCom5-Jan-05 23:55
SimCom5-Jan-05 23:55 
GeneralClass Confusion Pin
whitee5-Jan-05 7:57
whitee5-Jan-05 7:57 
I am trying to pass a pointer to an object to a function, and have this function to the work of creating the object. Although the object is assigned properly within the method, upon returning to the calling function, the object pointer that was passed has not changed. Could someone explain to me what is going on here?

I have an abstract class A and an inherited class B

<br />
Class A { doSomething(){} }<br />
<br />
Class B : A{<br />
  int x;<br />
  B(int x){<br />
    this->x=x;<br />
  }<br />
}<br />


Now, I want my class C to have a method that creates a pointer to A, passes this to a function, and that function changes the pointer so that it points to a new object of type B.

<br />
Class C {<br />
  getB(){<br />
    A* a;<br />
    FindIt(a); //pass the pointer<br />
//SO NOW WE HAVE a->new b(x)<br />
  }<br />
<br />
  FindIt(A* a){<br />
    int x=1;  //gather the data<br />
    B* b = new b(x); //create the object<br />
    a = (A*)b; //set the pointer<br />
  }<br />
}<br />

So, when I debug...after the call to Find It, a is not pointing at the correct memory address. What is going on?

whitee
GeneralRe: Class Confusion Pin
Gerald Schwab5-Jan-05 8:49
Gerald Schwab5-Jan-05 8:49 
GeneralDrawing rectangles, lines and arcs in directx Pin
SteQve5-Jan-05 7:51
SteQve5-Jan-05 7:51 
GeneralOpenGL question : wglUseFontBitmaps and glGenLists Pin
Maximilien5-Jan-05 4:55
Maximilien5-Jan-05 4:55 
GeneralRe: OpenGL question : wglUseFontBitmaps and glGenLists Pin
El Corazon5-Jan-05 7:03
El Corazon5-Jan-05 7:03 
GeneralRe: OpenGL question : wglUseFontBitmaps and glGenLists Pin
Maximilien5-Jan-05 7:21
Maximilien5-Jan-05 7:21 
GeneralFrom C to C++ Pointer Pin
jw815-Jan-05 4:55
jw815-Jan-05 4:55 
GeneralRe: From C to C++ Pointer Pin
David Crow5-Jan-05 5:24
David Crow5-Jan-05 5:24 
GeneralRe: From C to C++ Pointer Pin
jw815-Jan-05 5:26
jw815-Jan-05 5:26 
GeneralRe: From C to C++ Pointer Pin
David Crow5-Jan-05 5:54
David Crow5-Jan-05 5:54 
GeneralRe: From C to C++ Pointer Pin
jw815-Jan-05 15:38
jw815-Jan-05 15:38 
GeneralRe: From C to C++ Pointer Pin
Maximilien5-Jan-05 16:14
Maximilien5-Jan-05 16:14 
GeneralRe: From C to C++ Pointer Pin
jw815-Jan-05 17:16
jw815-Jan-05 17:16 
GeneralRe: From C to C++ Pointer Pin
ThatsAlok5-Jan-05 22:05
ThatsAlok5-Jan-05 22:05 
GeneralRe: From C to C++ Pointer Pin
Maximilien5-Jan-05 5:43
Maximilien5-Jan-05 5:43 
GeneralRe: How to draw static controls and check box buttons transparently ? Pin
rrrado5-Jan-05 3:41
rrrado5-Jan-05 3:41 
GeneralRe: How to draw static controls and check box buttons transparently ? Pin
YoSilver7-Jan-05 0:35
YoSilver7-Jan-05 0:35 
GeneralRe: How to draw static controls and check box buttons transparently ? Pin
rrrado11-Jan-05 4:04
rrrado11-Jan-05 4:04 

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.