class A {
public virtual void Method1(){}
public void Method2() {
Method1();
}
}
class B:A {
public override void Method1() { }
}
class main {
A myobject = new B();
myobject
.Method2();
}
So which function gets called?
B.Method1();
gets called because it properly overrides the virtual methodA.Method1();
No comments:
Post a Comment