Defining Sealed Classes

In managed C++, you can define a class as sealed, which means that the class cannot be used as a base class. Defining a class as sealed is a useful security measure if your class contains sensitive information or if it performs operations that you don’t want customized in derived classes.

To mark a class as sealed, use the __sealed keyword in the class definition as follows:

__gc __sealed class MyClass { // ... Class body, as before };

Microsoft Visual C++  .NET(c) Step by Step
Microsoft Visual C++ .NET(c) Step by Step
ISBN: 735615675
Year: 2003
Pages: 208 © 2008-2017.
If you may any questions please contact us: