inheritance
-
hi all abstract class c { abstract function() } class c1:c { override fucntion() { // } void function() { } } class c2:c1 { c1 obj=new c1() obj.//how do i differenciate that i wanna call overrided function and ordinanry function of c1
-
hi all abstract class c { abstract function() } class c1:c { override fucntion() { // } void function() { } } class c2:c1 { c1 obj=new c1() obj.//how do i differenciate that i wanna call overrided function and ordinanry function of c1
c.function will always call the overrided method. You cannot call the base one. If that's what you want, don't use overrides, using hiding:
class Base
{
public void Foo() { ... }
}class Derived : Base
{
public new void Foo() { ... }
}// Call the base one
Base obj = new Base();
obj.Foo();// Call the derived one
Derived derived = new Derived();
derived.Foo();Tech, life, family, faith: Give me a visit. I'm currently blogging about: Roman Catholic Relevance? The apostle Paul, modernly speaking: Epistles of Paul Judah Himango