Regards,
Shakthi
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Ilja Preuss:
In fact, the only reason for the existence of interfaces in the Java language is the absence of multiple inheritance for classes. If Java had MI for classes, interfaces would be redundant, because of being equivalent to fully abstract classes.
Philip Shanks, SCJP - Castro Valley, CA
My boss never outsources or has lay-offs, and He's always hiring. I work for Jesus! Prepare your resume!
Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Originally posted by Ilja Preuss:
In fact, the only reason for the existence of interfaces in the Java language is the absence of multiple inheritance for classes. If Java had MI for classes, interfaces would be redundant, because of being equivalent to fully abstract classes.
"I'm not back." - Bill Harding, Twister
"I'm not back." - Bill Harding, Twister
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
What does an Interface have a purely abstract class doesn't have?
Originally posted by Pavel Halas:
In fine we're all on the same boat. We develop in Java, and Sun decided to "substitute" problematic multiple inheritance with interface. But another point is that interface has its problems too. Consider two interfaces with the same method that differs only in return type and the class that implements them both...
Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Originally posted by Pavel Halas:
It could not be possible at all: We're using inheritance from library classes.
We have a class named MyApplet (for example). It must be extended from Applet. In Java you can't use multiple inheritance so you can't force implemetation of a methods from abstract class.
Could be difficult: The parent would be evidently artificial.
Capturing similarities between unrelated classes without artificially forcing a class relationship.
We should consider the rigth OO design.
No, that's not good question. Abstract class is fairly the same but with another use.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Ilja Preuss:
I still think that a purely abstract class is *exactly* the same (besides MI) and could be used exactly as interfaces are used.
Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
"I'm not back." - Bill Harding, Twister
Originally posted by Joel McNary:
I believe that C# nicely solved this problem by allowing you to declare which interface's method you were implementing. Thus, you could have a class that implemented both interfaces. The class would have two methods with the same name, but the signatures would be different -- one would be signed as being for InterfaceA and the other for InterfaceB (essentially, you have just overloaded the method).
Granted, I've never used C#, but I seem to recall Thomas Paul saying something along these lines....
Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
A tiny monkey bit me and I got tiny ads:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|