Private interface : interface « Class « Visual C++ .NET






Private interface

 
#include "stdafx.h"
interface class IInterface
{

   void f();
   int g();
};

ref class MyClass : IInterface
{
      virtual void f() sealed = IInterface::f
      { }

   public:
      virtual int g() { return 1; }
};

int main()
{
   MyClass^ r = gcnew MyClass();
   IInterface^ ir = r;
   ir->f();  // f may be called through the interface.

   r->g();     // OK
}

   
  








Related examples in the same category

1.Interface definition
2.base and interface
3.Interface and class(The virtual keyword is required to implement the interface method)
4.Interface list
5.Interface name collision
6.Interface properties events
7.constants in interfaces
8.interfaces implementing interfaces
9.multiple interfaces
10.static interfaces
11.class interface method ambiguity
12.Explicit interface implementation