+ Reply to Thread
Results 1 to 2 of 2

Thread: What is incomplete type in C++?

  1. #1

    What is incomplete type in C++?

    What is incomplete type in C++?

    Please help.

  2. #2
    An incomplete type is a type that describes an identifier but it does not defined fully and no required information available.

    It can be the case that a "structure" or "class" or union" name is available but its full definition is not.

    Following issue depicts the same behavior:

    Code:
    class CIncompleteType ;
    
    class CCompleteType
    {
    private:
    	CIncompleteType objIncompleteType ; //error C2079: 'objIncompleteType' uses undefined class 'CIncompleteType'
    	CIncompleteType *pIncompleteType ; //OK, till we create an object or it gets type definition for class 'CIncompleteType'!
    public:
    	
    } ;
    
    class CIncompleteType
    {
    } ;
    To resolve the compile time error, declare and define CIncompleteType just above the CCompleteType class.

    Thanks.

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

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