CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2005
    Posts
    1,030

    operator new without implementation?

    Here is the code,
    Code:
    class A
    {
    private:
    	void* operator new(size_t size);
    };
    
    int main()
    {
        return 0;
    }
    The code above compiles fine without errors. But operator new might not have implemenation body? Thanks.

  2. #2
    Join Date
    Jul 2002
    Posts
    2,543

    Re: operator new without implementation?

    Try to create instance of class A.

  3. #3
    Join Date
    Jan 2009
    Posts
    596

    Re: operator new without implementation?

    Your example is really no different to
    Code:
    class A
    {
    private:
    	void* someFunction();
    };
    
    int main()
    {
        return 0;
    }
    If you don't try to call someFunction, or new in your case, there is no problem.

  4. #4
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: operator new without implementation?

    Quote Originally Posted by LarryChen View Post
    Here is the code,
    Code:
    class A
    {
    private:
    	void* operator new(size_t size);
    };
    
    int main()
    {
        return 0;
    }
    The code above compiles fine without errors. But operator new might not have implemenation body? Thanks.
    Do you work with C++ or do you just sit around trying to come up with crazy questions?

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