<ja****@gmail.comwrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
: my header file looks like this:
:
: class A;
: class B;
: class C;
:
: class A
: {
: ....
: };
:
: class B:public A
: {
: private:
: B doSomething(A& a);
: public:
: B processMe(C c){...; doSomething(c);} // Problematic statment
: };
:
: class C: public A
: {
: ....
: }
:
: The problem is that by the time it reaches the line of code with the
: problematic statement, it hasn't declared yet that C indeed extends A.
: Is there any way on how I can declare this? Or any other possible
: options if i can't?
You have to provide the definition(=implementation)
of processMe after class C has been seen, for example:
class B:public A
{
private:
B doSomething(A& a);
public:
B processMe(C c); // (forward-)declaration
};
class C: public A
{
....
};
B A::processMe(C c) {...; doSomething(c);} // definition
(you could use reinterpret_cast, but this would formally be UB)
Ivan
--
http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form
Brainbench MVP for C++ <
http://www.brainbench.com