|
-
November 14th, 2020, 10:44 PM
#1
What does an interface not allowed to have any implementation?
Sometimes it makes sense for interface type class to be super class instead for example the Subject class in observer pattern where it has register, unregister and notify methods. Yet in C#, this would be an interface and this methods has to be implemented in each derived class who wants to send notifications.
What is the rational about it? It these functions were defined in parent class, it would fascinate code reuse, testability and modularity.
One can of course have such a class but then multiple inheritance is not allowed as well and it uses the life-line of single inheritance.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|