what is the diference btwn abstract class&interface in real time scenarioo(pls don't give normal answers)
By in Web Development on Dec 18 2006
  • Gurjinder Singh Brar
    Dec, 2006 29

    If the entities are of same type, perform some common function but the way of functioning in every case is totally different from each other, then you should declare an interface for them. In interface all function must be abstract means no functionality defined in interface. In this case child class must define body for all interface methods according to the way of functioning of individual entity.

    If the entities are of same type, perform some common function but the way of functioning in some cases is different from each other, then you should declare an abstract class for them. In abstract class at least one function must be abstract means no functionality defined. You define concrete methods where the way of functioning is same. In case of different way you leave the method without body (abstract) in abstract class.   In this case child class must define body for all abstract class methods  according  to the way of functioning of individual entity. There is no need to redefine the body of concrete abstract class methods.


    Thanks,
    Gurjinder Singh Brar
    http://agileguru.blogspot.com

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS