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

Threaded View

  1. #1
    Join Date
    Jul 2009
    Posts
    154

    static and constructors

    Hi,

    When is the constructor called in a situation like this?


    Code:
    class MyClass
    {
    public:
                             MyClass() { cout << "Hi" << endl; }
    
      static MyClass * GetInstance() { static MyClass myClass; return &myClass; }
    };
    Tricky one..
    Last edited by ProgrammerC++; October 3rd, 2010 at 05:38 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