Hi,
The following code is failing to enter A::g(int a):
#define _VIRTUAL_B_
volatile int x;
class C {
public:
virtual void g(int a) = 0;
};
class B
{
public:
#ifdef _VIRTUAL_B_
virtual void h() = 0;
#else
void h() {};
#endif
};
class A : public B, public C
{
public:
void g(int a);
#ifdef _VIRTUAL_B_
void h() {}
#endif
};
void A::g(int a) {
x=a;
}
A aa;
int main()
{
C *p = static_cast<C*>(&aa);
p->g(3);
return 0;
}
The above is a simplification of what I am trying to achieve in my own application.
Commenting out the #define works. The problem would seem to be that if class A inherits two base classes, then the polymorphism does not work. I have checked this out with Microsoft C++ and it works fine. I would appreciate if someone (hopefully a TI compiler Guru) could check this out for me. It also works if class B is changed to inherit C instead of A inheriting C directly.
Best regards
Martin Knott
Edinburgh, UK
I have Code Composer Studio Version: 6.1.0.00104, "CCS Product Branding" is
Version: 6.1.0.201502111100
Build id: N201502111100
Eclipse C/C++ Development Tools
Version: 8.5.0.201409172108
Eclipse GCC Cross Compiler Support
Version: 8.5.0.201409172108
I am using C++03 dialect (as embedded C++ does not support polymorphism).