Inheritance, Generics and Instantiation
Carnelune
Posted messages
5
Status
Membre
-
Carnelune Posted messages 5 Status Membre -
Carnelune Posted messages 5 Status Membre -
Hello,
I am currently reviewing object inheritance, and I'm having trouble understanding all the relationships between concrete classes, abstract classes, and interfaces.
Here is an exercise with corrections that summarizes the different cases, but I can't seem to grasp everything.
http://img15.hostingpics.net/pics/260310jawa.jpg
_X: interfaces, $X: abstract classes.
Could someone explain the validation and invalidation of the propositions? I understand why there are double implementations, that abstract classes are non-instantiable, and that multiple inheritance is not allowed. But I'm still stuck...
Thanks in advance to those who will respond!
Configuration: Windows 7 / Firefox 23.0
I am currently reviewing object inheritance, and I'm having trouble understanding all the relationships between concrete classes, abstract classes, and interfaces.
Here is an exercise with corrections that summarizes the different cases, but I can't seem to grasp everything.
http://img15.hostingpics.net/pics/260310jawa.jpg
_X: interfaces, $X: abstract classes.
Could someone explain the validation and invalidation of the propositions? I understand why there are double implementations, that abstract classes are non-instantiable, and that multiple inheritance is not allowed. But I'm still stuck...
Thanks in advance to those who will respond!
Configuration: Windows 7 / Firefox 23.0
1 réponse
Already a very bad idea to use $ in class names!
For _ it's less serious but still to be avoided...
In any case, assignment is possible if the concrete type is a descendant of the declared type. For example, for the first two: E is a descendant of _N (via _A), but F is not. Trust does not exclude control.
For _ it's less serious but still to be avoided...
In any case, assignment is possible if the concrete type is a descendant of the declared type. For example, for the first two: E is a descendant of _N (via _A), but F is not. Trust does not exclude control.
And for the third one, for example? Neither of the two descends from the other...
Thank you for your quick response!
As long as you don't use them in practice...
"And what about the third one, for example? Neither of the two descends from the other..."
Of course it does, everything descends from _M so there’s no problem (H via $G, B, _Q)