Are attributes inherited?

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)
 
B

Basti Wiesner

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top