Defining Inheritance
There are situations where you create classes that inherit from other classes that are decorated with attributes. Attribute inheritance is not automatic in that you can establish whether your attributes are inheritable. You establish this behavior by setting the Inherited
property at AttributeUsage
level. By default, if you do not explicitly set Inherited
, it is considered as True
. The following example shows how you enable attribute inheritance:
The following snippet shows instead how to make an attribute not inheritable:
Inheritance is enabled by default because if a base class is decorated with attributes, derived classes ...
Get Visual Basic® 2010 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.