This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Class forward declaration with RealView Compiler

Hello,

i have a question related to Realview Compiler V3.0.
Is the forward declaration of a class not supported or
is it a mistake of me?
Please look the example below:

class clsB;     // Forward Declaration  Not Working


class clsA
{
  public:
        clsA();         // Constructor

        clsB  oB;       // Compiler error:  #70: incomplete type is not allowed
};




class clsB
{
  public:
        clsB();         // Constructor
};

Thank you
Eugen

Parents
  • It is a mistake by you.

    The forward declaration only informs that there is a class clasB - the compiler doesn't know it's size, so you can't have a member of type clasB.

    You can have a member of reference to clasB or pointer to clasB, since they have fixed size.

Reply
  • It is a mistake by you.

    The forward declaration only informs that there is a class clasB - the compiler doesn't know it's size, so you can't have a member of type clasB.

    You can have a member of reference to clasB or pointer to clasB, since they have fixed size.

Children