Inherit from Class and Interface

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
 
B

Brandon Bray [MSFT]

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 {};
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top