M
Michael
Hi,
A piece of description about multi inheritance in ISO/ANSI C++ standard is
as following:
A class shall not be specified as a direct base class of a derived class
more than once.
[Note: a class can be an indirect base class more than once and can be a
direct and an indirect base class. ]
Example:
class X { /* ... */ };
class Y : public X, public X { /* ... */ }; // illformed
class L { public: int next; /* ... */ };
class A : public L { /* ... */ };
class B : public L { /* ... */ };
class C : public A, public B { void f(); /* ... */ }; // wellformed
class D : public A, public L { void f(); /* ... */ }; // wellformed
if above class D is OK. why can't the following code be compiled with Visual
C++
#include "stdafx.h"
#include<iostream>
class v
{};
class bublic v
{};
class eublic v
{};
class dublic b,public v
{};
int main()
{ return 0;}
But the following code work well.
#include "stdafx.h"
#include<iostream>
class v
{};
class bublic v
{};
class eublic v
{};
class dublic b,public e
{};
int main()
{ return 0;}
thanks in advance
Michael
A piece of description about multi inheritance in ISO/ANSI C++ standard is
as following:
A class shall not be specified as a direct base class of a derived class
more than once.
[Note: a class can be an indirect base class more than once and can be a
direct and an indirect base class. ]
Example:
class X { /* ... */ };
class Y : public X, public X { /* ... */ }; // illformed
class L { public: int next; /* ... */ };
class A : public L { /* ... */ };
class B : public L { /* ... */ };
class C : public A, public B { void f(); /* ... */ }; // wellformed
class D : public A, public L { void f(); /* ... */ }; // wellformed
if above class D is OK. why can't the following code be compiled with Visual
C++
#include "stdafx.h"
#include<iostream>
class v
{};
class bublic v
{};
class eublic v
{};
class dublic b,public v
{};
int main()
{ return 0;}
But the following code work well.
#include "stdafx.h"
#include<iostream>
class v
{};
class bublic v
{};
class eublic v
{};
class dublic b,public e
{};
int main()
{ return 0;}
thanks in advance
Michael