Re: Can Interfaces be mimicked with classes



Can the functionality of interfaces be mimicked with classes??

No, can't.
You can not create class even with two "extended" parents, but you may
"implement" as many interfaces as you like.

If so why would the language designers choose to include interfaces in the
language design when classes alone would have been sufficient

Interfaces are something like drawing pencils and classes like
painting colors. Even Van Gogh used pencils ... and you say we should
not use interfaces!

.



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
    ... sundarvenkata wrote: ... why would the language designers choose to include interfaces in the ... language design when classes alone would have been sufficient ... that interfaces allow multiple inheritance where classes don't. ...
    (comp.lang.java.programmer)
  • Re: Teaching new tricks to an old dog (C++ -->Ada)
    ... > X, not per language design. ... > data are primitive operations. ... If C has abstract Foo, ... If A and B are interfaces then X.Foo ...
    (comp.lang.cpp)
  • Re: Teaching new tricks to an old dog (C++ -->Ada)
    ... > X, not per language design. ... > data are primitive operations. ... If C has abstract Foo, ... If A and B are interfaces then X.Foo ...
    (comp.lang.ada)