Mega Code Archive

 
Categories / Visual C++ .NET / Class
 

Static interfaces

#include "stdafx.h" using namespace System; interface class MyInterface {    static int i = 6;    static const int j = 100;    static void f()  { Console::WriteLine("MyInterface::f " + i); } }; ref class A : MyInterface {    public:    static void f() { Console::WriteLine("A::f " + MyInterface::j); } }; int main() {    A^ a = gcnew A();    MyInterface^ ia = a;    ia->f();        a->f();         MyInterface::f();    A::f();          a->MyInterface::f(); }