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

Threaded View

  1. #4
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: [MFC] Refreshing Picture Control

    You can pass the pointer of 1 class to another.

    Something like this...
    Code:
    class A
    {
    public:
    
       int MyVariable;
    
    };
    
    
    
    class B
    {
    public:
    
      A *MyA;
      
      void SomeFunction ()
      {
          MyA->MyVariable = 10;
      }
    
    };
    
    
    
    int main ()
    {
      A varA;
      B varB;
    
      varB.MyA = &varA;                 // set the pointer of varA
      varB.SomeFunction ();             // this function uses the varA-pointer to set MyVariable
    
    };
    Last edited by Skizmo; July 28th, 2010 at 06:29 AM.

Tags for this Thread

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