Compiler Error C3252
Visual Studio 2015
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at Compiler Error C3252.
method' : cannot reduce accessibility of a virtual method in a managed or WinRT type
A class that implements a virtual method from a base class or any method from an interface cannot reduce the access of that method.
Note that all methods in an interface are public.
The following sample generates C3252 and shows how to fix it:
// C3252.cpp
// compile with: /clr /c
ref class A {
public:
virtual void f1() {}
};
ref class B : public A {
// To fix, uncomment the following line:
// public:
virtual void f1() override sealed {} // C3252, make this method public
};
Show: