0

Implementing multiple inheritance and implenting interface is same or not???

in java implementing multiple inheritance and implementing interface is same ...

24th Sep 2018, 3:02 AM
Nick
Nick - avatar
2 ответов
0
No. Interface is just a declaration. It has no code. When you inherit an interface you have to implement all it's methods. That cause code replicate. Multiple inheritance allows to inherit complete class and reuse it's functionality without code duplication. For example C++ has standard class std::enable_shared_from_this that could be used in the multiple inheritance to change creation behavior. You don't need to implement something special after inheritance, but can use the result of it.
24th Sep 2018, 3:53 AM
Sergey Ushakov
Sergey Ushakov - avatar