| Author |
Real Time Scenerio for abstract class and interface
|
Giri moh'kar
Greenhorn
Joined: Jun 11, 2007
Posts: 7
|
|
|
when do we use abstract class and interface?do we have any real time example?
|
 |
Peter Chase
Ranch Hand
Joined: Oct 30, 2001
Posts: 1970
|
|
|
I'm guessing you don't really mean real time.
|
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.<br /> <br />#:^P
|
 |
Kaydell Leavitt
Ranch Hand
Joined: Nov 18, 2006
Posts: 679
|
|
Welcome to the Java Ranch, I take it that you mean "real-world" instead of "real-time". A real-world example is a "fruit". We can consider using either an interface or an abstract class. Since all fruits have a common property, weight, an abstract class should be used rather than an interface since interfaces can't contain variables. (Though, you might find a reason to use both an abstract class and interfaces). Concrete classes of fruit could be "apple", "bannanna", and a "pear". Kaydell [ June 11, 2007: Message edited by: Kaydell Leavitt ]
|
 |
Giri moh'kar
Greenhorn
Joined: Jun 11, 2007
Posts: 7
|
|
|
Thanks Kaydell Leavitt..
|
 |
 |
|
|
subject: Real Time Scenerio for abstract class and interface
|
|
|