R
relient
I am trying to understand the code below but I need some affirmation of
the following first: The reason I inherit the "Base" class method
implementation instead of the "Derived" class method in the class
"Third" is because the class "Derived" method has no implementation
because it's abstract. Am I right? Also, this is the only time this
applies in a chain of derived classes. So if the "Derived" class method
wasn't abstract, then, class "Third" would inherit the "Derived" class
method because a derived class always inherits from the last class.
Also, The placement of the keywords override and abstract in the method
signature in class "Derived" doesn't matter. Right? If they're
switched, It's the same thing (yes?). I personally think it's more
readable the way it's currently set. Switching them makes the signature
confusing to understand. So I don't understand why it was even allowed
in C#. What do you think?
class Base
{
public virtual void DrawYourself()
{
}
}
abstract class Derived : Base
{
public override abstract void DrawYourself( );
}
class Third : Derived
{
public override void DrawYourself( )
{
}
}
Thanks for reading,
Relient.
the following first: The reason I inherit the "Base" class method
implementation instead of the "Derived" class method in the class
"Third" is because the class "Derived" method has no implementation
because it's abstract. Am I right? Also, this is the only time this
applies in a chain of derived classes. So if the "Derived" class method
wasn't abstract, then, class "Third" would inherit the "Derived" class
method because a derived class always inherits from the last class.
Also, The placement of the keywords override and abstract in the method
signature in class "Derived" doesn't matter. Right? If they're
switched, It's the same thing (yes?). I personally think it's more
readable the way it's currently set. Switching them makes the signature
confusing to understand. So I don't understand why it was even allowed
in C#. What do you think?
class Base
{
public virtual void DrawYourself()
{
}
}
abstract class Derived : Base
{
public override abstract void DrawYourself( );
}
class Third : Derived
{
public override void DrawYourself( )
{
}
}
Thanks for reading,
Relient.