Cook Computing

 

«  Reducing Accessibility of Virtual Methods (or Not)  »

Tuesday 28 May 2002

The suggested class in the previous posting relied on the fact that in C++ you can reduce the accessibility of a virtual method in a derived class:

class Parent
{
public:
  void virtual Foo() { };
};

class Child : public Parent
{
private:
  void Foo() { };
};

However this is not possible in Managed C++ if the classes are marked with __gc (and is incidentally also not possible in C#). Another example of how languages have to be distorted in the cause of interop with other .NET languages.

Posted by at 06:46 PM. Permalink.