G
Guest
I have a question on calling parent class... What I want to do is: when
calling the derived class, it automatically executes the parent's method, is
it possible?
// main code:
Derived d = new Derived();
d.SomeMethod();
public class Base
{
public virtual void SomeMethod() {
Console.WriteLine "A";
}
}
public class Derived : Base
{
public override void SomeMethod() {
// this.parent.SomeMethod();
Console.WriteLine "B";
}
}
Is there a way to call the derived class and then both "A" and "B" will be
printed out?
calling the derived class, it automatically executes the parent's method, is
it possible?
// main code:
Derived d = new Derived();
d.SomeMethod();
public class Base
{
public virtual void SomeMethod() {
Console.WriteLine "A";
}
}
public class Derived : Base
{
public override void SomeMethod() {
// this.parent.SomeMethod();
Console.WriteLine "B";
}
}
Is there a way to call the derived class and then both "A" and "B" will be
printed out?