Login Register


Anyone know anything about polymorphism? filter_list
Author
Message
RE: Anyone know anything about polymorphism? #3
(05-27-2015, 01:59 AM)6e6b Wrote: maybe this site would help? http://www.tutorialspoint.com/java/java_...rphism.htm

public interface Vegetarian{}
public class Animal{}
public class Deer extends Animal implements Vegetarian{}


Now, the Deer class is considered to be polymorphic since this has multiple inheritance. Following are true for the above example:

A Deer IS-A Animal

A Deer IS-A Vegetarian

A Deer IS-A Deer

A Deer IS-A Object

Better in Code, Definitions are.

Thanks, dude. The code you supplied is pretty informative, even with my limited Java knowledge. (However, I figured it out after messing with classes and methods in Ruby)

Just one thing, use code tags ("code" and "/code", replacing the " with square brackets) when writing out code, as it keeps indents intact.
It's often the outcasts, the iconoclasts ... those who have the least to lose because they
don't have much in the first place, who feel the new currents and ride them the farthest.

Reply





Messages In This Thread
RE: Anyone know anything about polymorphism? - by Inori - 05-27-2015, 02:14 AM



Users browsing this thread: