[cfe-dev] How to determine base class direct or not?
r4start
r4start at gmail.com
Thu Nov 10 05:35:39 PST 2011
Hi all!
Can anybody help me with following problem. I have such code:
class B {
public:
virtual void b(){}
double b_field;
};
struct D : B {
virtual void fr(){}
};
class C {
public:
virtual void C_f(){}
};
class A : public C,
public virtual D {
public:
int a_field;
virtual void a(){}
};
class A1 : public C, public B,
public virtual D {
public:
int a_field;
virtual void a(){}
};
I write function that determines "Has class and his bases a common base?".
For example for class A this function returns false and for class A1 -
true. In A1 as you can see B is base class for A1 and for D.
I tried to use isDerivedFrom(), but this function searches path from A
to B(path is A->D->B) and if path exists return true.
I need something like isDirectDerivedFrom.
So my question is, what is the best way to determine these relations?
- Dmitry.
More information about the cfe-dev
mailing list