Click here to Skip to main content
15,922,584 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
why Mvc Controller class is abstract even there is no abstract method in it.Recommendations for uses of Abstract Classes and Interfaces.

What I have tried:

why Mvc Controller class is abstract even there is no abstract method in it.Recommendations for uses of Abstract Classes and Interfaces.
Posted
Updated 6-May-16 18:50pm
Comments
Sergey Alexandrovich Kryukov 7-May-16 0:43am    
Who told you that an abstract class requires abstract methods?
—SA

1 solution

First part of the question is pretty much absurd; probably based on some wrong assumption of your fantasy — please see my comment to the question. However, even this part of question has some rational grain. Indeed, an abstract class without virtual methods and properties makes little to no sense, but such members don't need to be only methods, and they don't need to be abstract. They can be non-abstract or pseudo-abstract. It all depends on the required functionality and code design.

The choice between using an abstract base class vs interface should be driven by understanding of each, as well as late binding and polymorphism, essence of OOP, not on some cookbook recipes or "recommendation". You should derive you search from the goals of some programming system and requirements.

You can find some key ideas in these past answers:
When we use abstract and when we use interface...?[^],
Difference between abstract class and interface if they have same no of methods and var[^],
How to decide to choose Abstract class or an Interface[^],
Interfaces and Polymorphism[^],
POLYMORPHISM WITHOUT OVERLOADING AND OVERRRIDING IS POSSIBLE[^],
Doubts on Interfaces[^],
Why we need to create instance for interface not for implementation?[^],
If abstact class implements the interface then is there any need to implement interface method in abstract class.[^].

—SA
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900