C++/CLI: Explicit interface property implementation

  • Thread starter Thread starter innes
  • Start date Start date
I

innes

Hi,
I'm unable to work out the syntax for explicit implementation of an
interface property.

Example Code:
-----

public interface class ITest
{
int M();
property int P { int get(); }
};

public ref class C : ITest
{
protected:
virtual int M() = ITest::M
{ return 0; }

virtual property int P = ITest::P // <==============
{
int get()
{ return 0; }
}
};

-----

The line commented with an arrow is my wild guess at what the syntax
might be, but this doesn't compile.

Does anyone know the correct syntax?

Thanks,
Innes
 
innes said:
Hi,
I'm unable to work out the syntax for explicit implementation of an
interface property.

Example Code:
-----

public interface class ITest
{
int M();
property int P { int get(); }
};

public ref class C : ITest
{
protected:
virtual int M() = ITest::M
{ return 0; }

virtual property int P = ITest::P // <==============
{
int get()
{ return 0; }
}
};

-----

The line commented with an arrow is my wild guess at what the syntax
might be, but this doesn't compile.

Does anyone know the correct syntax?


// All the implementations of the interface need to be public and marked
virtual...

public interface class ITest
{
int M();
property int P { int get(); }
};

public ref class C : ITest
{
public:

virtual int M()
{ return 0; }

property int P
{
virtual int get()
{ return 0; }
}
};

Mark
 
Back
Top