I want to extend the C++ namespace
of classes in a Linux shared object through inheritance. What are the issues that can arise, in particular involving static objects and member data?
// as a crude example (note: untested code)
// compiled into libBase.so
namespace foo
{
class Cfoo
{
protected:
static double Pi; // defined outside header
public:
Cfoo () {}
double fooPi () { Pi *= Pi; return Pi; }
};
}
// compiled into libDerived.so
namespace foo
{
class Cbar : public Cfoo
{
double barPi () { Pi = sqrt(Pi); return Pi; }
};
}
Platform: GCC 4.5 on RHEL 5.