abstract class and its real time usage
need real time application usage where we use abstract class and its needs
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Ajay GohilPosted Dec 9, 2019, 10:30 PM
Why we need an abstract class?
Lets say we have a class
Animalthat has a methodsound()and the subclasses of it likeDog,Lion,Horse,Catetc. Since the animal sound differs from one animal to another, there is no point to implement this method in parent class. This is because every child class must override this method to give its own implementation details, likeLionclass will say “Roar” in this method andDogclass will say “Woof”.So when we know that all the animal child classes will and should override this method, then there is no point to implement this method in parent class. Thus, making this method abstract would be the good choice as by making this method abstract we force all the sub classes to implement this method( otherwise you will get compilation error), also we need not to give any implementation to this method in parent class.
Samir BhogaytaPosted Dec 3, 2019, 3:52 AM
Mageshwaran RPosted Nov 25, 2019, 10:23 AM
Jayanth ReddyPosted Aug 21, 2019, 12:59 AM
Rajanikant HawaldarPosted Aug 12, 2019, 11:43 PM
Sonu GuptaPosted Aug 12, 2019, 11:28 PM
Vishal PatelPosted Aug 12, 2019, 12:00 PM
Aakash MauryaPosted Aug 12, 2019, 8:29 AM