CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Threaded View

  1. #1
    Join Date
    Mar 2011
    Posts
    4

    [solved] Code doesn't update

    Hello,

    I have some problems with a example that I am making. I want to:
    1: send a "pointer to an object" to a other object
    2: that object needs to call a function of the object that I send to him.

    I made this:
    Code:
    //this is a part of my class:
    
    class aanroepding {
    public:
    	void laatestzien() { std::cout << "some text"; } //this is the function that is getting called, only when I edit the text, it does not update. 
    };
     
    class vanafhieraanroepen {
    public:
    	void callfunctievanandereclass(aanroepding* obj) { obj->laatestzien(); } //this takes the pointer and cals a function of the object
    };
    
    // that is a part of the main() :
    
    vanafhieraanroepen testing4; //makes a object with the name testing4
    aanroepding* testing5 = new aanroepding; // makes a pointer that points to an object
    testing4.callfunctievanandereclass(testing5); //pass the pointer to testing4
    delete testing5; //deletes the pointer
    When I run it for the first time, then everything works fine, but when I change the text of this class:

    Code:
    class aanroepding {
    public:
    	void laatestzien() { std::cout << "some text"; } //this is the function that is getting called, only when I edit the text, it does not update. 
    };
    then he showes me the old text, so it does not update. Does some one see what I did wrong?
    Even when I call delete on the pointer obj, then it also does not work.
    Last edited by lauwdude; March 22nd, 2011 at 09:02 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured