View Single Post
  #1 (permalink)  
Old 11-20-2007, 09:16 PM
sireesha sireesha is offline
Member
 
Join Date: Nov 2007
Posts: 50
sireesha is on a distinguished road
i can't understand using interface as a type
Hi friends,
in the below code Relatable is the interface name.

Code:
public Object findLargest(Object object1, Object object2) { Relatable obj1 = (Relatable)object1; Relatable obj2 = (Relatable)object2; if ( (obj1).isLargerThan(obj2) > 0) return object1; else return object2; }
I read that we can use a reference type just like other datatypes.
Then how can we call a function using reference datatype variable like in the above code ?
and also they placed obj1 in the if condition in ().
what it indicates ?
Reply With Quote
Sponsored Links