• Post Reply Bookmark Topic Watch Topic
  • New Topic

please tell me whether the following is overridding or not  RSS feed

 
suresh sai
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the following.

class A
{

}

class B extends A
{



}

class C
{
void method1( B objectB)
{


}

}

class D extends C
{
void method1(A objectA)
{

}


}

I think that,in the above scenario ,the method "method1" is a over ridding method.Because reference variable objectB passing the IS-A test for class of type A.Could you please tell me whether it is right or not?If not under what circumstences for method arguments of type reference variables,it is become over ridding.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by chinna suresh:
...Could you please tell me whether it is right or not? ...

In situations like this, it's helpful to try and write some test code...

[ July 27, 2007: Message edited by: marc weber ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!