It seems like there is implementation difference from ISOIEC14882-1998 rules regarding multiple inheritance and private access specifier.
The private virtual base destructor is accessible from most derived class. No compile time error and no runtime error for program.
class DisableDerive
{
public:
DisableDerive(){ ; }
private:
~DisableDerive(){ ; }
friend class NonDerivable;
};
class NonDerivable: virtual protected DisableDerive
{
private:
int m_nVal;
public:
NonDerivable()
{
std::cout<<"NonDerivable::NonDerivable()\n";
m_nVal = -1;
}
~NonDerivable()
{
std::cout<<"NonDerivable::~NonDerivable()\n";
}
void SetValue( int nVal ){ m_nVal = 10; }
};
class TryDerive: public NonDerivable
{
public:
TryDerive(){ ; }
~TryDerive(){ ; }
};
int main()
{
TryDerive a;
return 0;
}
This code is getting compiled and executed. But there must be an error because the DisableDerive::~DisableDerive must not be accessible from TryDerive. The constructor is not accessible and the problem is only with destructor.
This code is giving expected compile time error in Visual Studio 6.0.
Microsoft Comments on this bug
Thanks for your feedback. We have reproduced this bug on Win2003 SP2 and OrcasBeta1VSTS, and we are sending this bug to the appropriate group within the Visual Studio Product Team for triage and resolution. Thank you, Visual Studio Product Team.
Posted by Microsoft on 6/26/2007 at 8:24 PM
2 comments:
replica bags canada replica prada nylon bags replica bags chicago
their explanation aaa replica bags her comment is here Dolabuy Chrome-Hearts additional hints Chloe Dolabuy
Post a Comment