blue_gene
03-25-2004, 03:03 PM
hi, many a times i confuse overriding of methods. can any body explain it clearly.
suppose i have a class call it class A. and i have a child class call it B.
so
class A
{
modifier return_rype somemethod(par1,par2,...) { //code }
}
class B extends A
{
modifier return_rype somemethod(par1,par2,...) { // may be different body }
}
now my question is : by watching what i should call the method has been overridden ?
is it the return type , no of parameters and the name of the method ? if i see these are same between two class then should i term it as overridden method ? does modifier can play role ?
i am not sure about it. can anybody explain when a method will be called overridden. i.e
by observing what i can call a method has been overridden ?
thanks
suppose i have a class call it class A. and i have a child class call it B.
so
class A
{
modifier return_rype somemethod(par1,par2,...) { //code }
}
class B extends A
{
modifier return_rype somemethod(par1,par2,...) { // may be different body }
}
now my question is : by watching what i should call the method has been overridden ?
is it the return type , no of parameters and the name of the method ? if i see these are same between two class then should i term it as overridden method ? does modifier can play role ?
i am not sure about it. can anybody explain when a method will be called overridden. i.e
by observing what i can call a method has been overridden ?
thanks