Re: Can Interfaces be mimicked with classes
Hi,
sundarvenkata wrote:
Can the functionality of interfaces be mimicked with classes?? If so
why would the language designers choose to include interfaces in the
language design when classes alone would have been sufficient
You are right, that an abstract class can be a substitude for an
interface in some cases.
Note however, that interfaces allow multiple inheritance where classes
don't.
Ciao,
Ingo
.
Relevant Pages
- Can Interfaces be mimicked with classes
... Can the functionality of interfaces be mimicked with classes?? ... why would the language designers choose to include interfaces in the ... language design when classes alone would have been sufficient ... (comp.lang.java.programmer) - Re: Can Interfaces be mimicked with classes
... But the methods only have a signature, not any implementation you can delegate to so they avoid the "diamond" problem of multiple inheritance. ... So unlike classes that allow implementations, you can have many interfaces implemented by a class. ... why would the language designers choose to include interfaces in the ... language design when classes alone would have been sufficient ... (comp.lang.java.programmer) - Re: which languages that support the construct "interface Foo : X {...}"
... interfaces need to be implemented by delegation, ... Type erasure makes Java's generics essentially worthless for ... The language designers went to a lot of effort ... (comp.object) - Re: which languages that support the construct "interface Foo : X {...}"
... interfaces need to be implemented by delegation, ... class Foo: public SomeTemplate ... Type erasure makes Java's generics essentially worthless for ... The language designers went to a lot of effort ... (comp.object) - Re: Can Interfaces be mimicked with classes
... language design when classes alone would have been sufficient ... Interfaces are something like drawing pencils and classes like ... (comp.lang.java.programmer) |
|