Inherit from Class and Interface

  • Thread starter Thread starter Sebastian Dau
  • Start date Start date
S

Sebastian Dau

Hey,

I'm looking for the right syntax to inherit my class from an Interface and
a class at the same time:

__interface ITest
{

};

__gc class CTest
{

};

__gc CDerivedTest : public CTest , ITest
{

};

The upper syntax is slightly wrong and I can't get it to run.
How do I express inheritance from class and Interface at the same time?
Thanks, Sebastian
 
Sebastian said:
The upper syntax is slightly wrong and I can't get it to run.
How do I express inheritance from class and Interface at the same time?
Thanks, Sebastian

You need to add another public, as interfaces (just like __gc classes)
always require public inheritance.

__interface ITest {};
__gc class CTest {};
__gc CDerivedTest : public CTest , public ITest {};
 
Back
Top