2
Reply

In which Scenario you will go for Interface or Abstract Class?

18y
15.3k
0
Reply

    Its dependent, the time of designing the application. suppose your's requirement is clear the time of design and using the waterfall design model, You can use the Interface instead of abastract class. if your requirement is subsequently changes and using agile design pattern then you can use abstract class instead of Interface.

    when u want to go for inheritance in so many derived classes but the methods implementations are different for different derived classes then u will make the class as abstract or interface. When all the method's implementations are based on derived class u will go for interface and if few implementations are common and remaining depends on derived class u will go for abstract class where u can have defined as well as declared methods also. Note: abstract and interface classes are used when their methods are mandatory for derived classes and are not optional. They put restriction on derived classes that they cannot skip those methods withoud having them in it. bye -Ram Nath Nishad New Horizons India Ltd, N-101,Manipal Center, Bangalore, India

    18y
    0