Are attributes inherited?

  • Thread starter Thread starter David Laub
  • Start date Start date
D

David Laub

If I have the following code

[MyAttr]
class XYZ
{
}

class InheritXYZ : XYZ
{
}

Is the [MyAttr] attribute defined for class XYZ automatically also defined
for class InheritXYZ (because InheritXYZ is inherited from XYZ)
 
David said:
If I have the following code

[MyAttr]
class XYZ
{
}

class InheritXYZ : XYZ
{
}

Is the [MyAttr] attribute defined for class XYZ automatically also defined
for class InheritXYZ (because InheritXYZ is inherited from XYZ)
Depends on the Attribute class. Some attributes aren't inherited.
 
Back
Top