Home>

Call a class within a class,
In that, I would like to define a function as follows:

class A: C (A is a class that inherits something)
{
class B
{
int func ();
}
};

At this time,
Where and how to describe the contents of the func function
Is it good?

Thank you.
The following two were not good.


class A: C
{
class B
{
int func ();
};
B :: int func ();
};

class A: C
{
class B
{
int func ();
};
};

A :: B :: int func (); Error message
qualified name is not allowed.
Applicable source code
C ++
Tried

The above two points

Supplemental information (FW/tool version etc.)
c++
  • Answer # 1

    If you don't write the implementation directly in func, write it outside A.
    The position of the return type is different.

    class A: C
    {
        class B
        {
            int func ();
        };
    };
    int A :: B :: func ()
    {
        ~
    }