In my programming class today we started touching onto class inheritance, and the professor posed a question he couldn't answer off the top of his head.
In a hierarchical chain of classes where each one extends the previous, and overrides the same function lets say foo(), how would you call a foo from several steps up the chain, were super.foo() would only call 1 above.
Code:
---------
class A
{
foo(){}
}
class B extends A
{
foo(){}
}
class C extends B
{
foo(){}
}
class D extends C
{
foo(){}
}
D obj = new D();
---------
How could obj call foo defined in B or A?
Read More...
Friday, February 20, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment