how do I use __interface? In C# if I declare an "interface" like so:
Then declare a class that uses the interface
This makes the compiler happy because I have a class Person that is using the interface IPeople and Person has declared the "Test" function. If I comment out "void Test();" then the compiler has a fit, telling me to declare the Test function.
How can I get the same functionality in C++? I've tried the following with no luck, it compiles without errors or warning, when it should give me at least one error.
This should throw an error as far as I understand it, but it compiles with no problems. How do I fix this?
BTW, I've also tried this
Still no errors.
Code:
interface IPeople
{
void Test();
}
Then declare a class that uses the interface
Code:
class Person : IPeople
{
Person();
void Test();
}
This makes the compiler happy because I have a class Person that is using the interface IPeople and Person has declared the "Test" function. If I comment out "void Test();" then the compiler has a fit, telling me to declare the Test function.
How can I get the same functionality in C++? I've tried the following with no luck, it compiles without errors or warning, when it should give me at least one error.
Code:
__interface IPeople
{
void Test();
};
class Person : public IPeople
{
Person();
~Person();
//void Test();
};
This should throw an error as far as I understand it, but it compiles with no problems. How do I fix this?
BTW, I've also tried this
Code:
class IPeople
{
virtual void Test() = 0;
};
class Person : public IPeople
{
Person();
~Person();
//virtual void Test();
};
Still no errors.