Implementing interfaces with properties in managed c++

Here is an example of code that demonstrates how to implement a property defined in a base class or interface:
public interface MyInterface
{
float InterfacePropertyOne { get; set; }

int InterfaceMethodOne();

string InterfaceMethodTwo();
}

public ref class Class1 : public CSharpLib::MyInterface
{
public:
virtual int InterfaceMethodOne() { return 0; };

virtual System::String^ InterfaceMethodTwo() {return ""; };

virtual property float InterfacePropertyOne
{
void set(float value) { };
float get() { return 0; };
};
};

Post a Comment

Previous Post Next Post