May 2010
Intermediate to advanced
1272 pages
61h 18m
English
NotInheritable KeywordThere are situations in which you might want to prevent inheritance from your classes. This can be useful if you do not want a client to modify in any way the base object’s behavior and its members. To accomplish this, you simply need to mark a class with the NotInheritable keyword. The following code shows an example of a class that cannot be derived:

As you can see, the BusinessPerson class is marked as NotInheritable and cannot be derived by other classes. It can still inherit from other classes but, obviously, members cannot be marked as Overridable, being not inheritable. Another typical example of not inheritable classes ...
Read now
Unlock full access