R
Ralf
Problem: Overriding virtual method of inner class of base, in a derived class.
The following gives compilation error.
How to solve this problem?
class TCB
{
public:
TCB() { }
struct TS
{
void Print() { /*...*/ ; PrintMore(); }
virtual void PrintMore() { }
} S;
};
class TCD : virtual public TCB
{
public:
TCD() { }
void TS:rintMore() { /*...*/ } // test.cpp:19: error: cannot define member function ‘TCB::TS:rintMore’ within ‘TCD’
};
int main(int argc, char* argv[])
{
TCD O;
O.S.Print();
return 0;
}
The following gives compilation error.
How to solve this problem?
class TCB
{
public:
TCB() { }
struct TS
{
void Print() { /*...*/ ; PrintMore(); }
virtual void PrintMore() { }
} S;
};
class TCD : virtual public TCB
{
public:
TCD() { }
void TS:rintMore() { /*...*/ } // test.cpp:19: error: cannot define member function ‘TCB::TS:rintMore’ within ‘TCD’
};
int main(int argc, char* argv[])
{
TCD O;
O.S.Print();
return 0;
}