C++/CX: Inheritance, ref, sealed class and base classes
Getting my ideas from DirectX 11.1 Game Programming for blogs.
Using the example set-up in my blog: C++/CX: Inheritance in the CX, set up the project
What is a sealed class?
A class that is sealed is a context-sensitive keyword for ref classes that indicates that a virtual member cannot be overridden, or that a type cannot be used as a base type. see: sealed (C++ Component Extensions)
Example of use:
ref class CDemoObject sealed : public CDemoProperty { public: CDemoObject(){}; protected: virtual void PickGetType() override { CDemoProperty::PickGetType(); }; };
What about the final keyword?
In the C++/11, the final keyword is defined as, it is used in standard classes
You can use the final identifier to designate virtual functions that cannot be overridden in a derived class. You can also use it to designate classes that cannot be inherited.
For examples that demonstrate the use of the final keyword see: