What is the point of inheritance? What gets inherited when classes - ProProfs Discuss
Advertisement

What is the point of inheritance? What gets inherited when classes extend other classes? Why is this important and very useful?



Asked by BOYD, Last updated: Mar 29, 2024

+ Answer
Request
Question menu
Vote up Vote down

1 Answer

John Smith

John Smith

John Smith
John Smith

Answered Sep 09, 2016

Code reuse is the important buzzword. using inheritance properly is a characteristic of a good data designer and programmer. aside from being a phenomenal tool to visualize and process the abstract theory known as objects, they create highly-flexible and usable classes that can be repurposed and reused in new requirements.for example, a database connection class can create the framework for connecting to databases, along with queries. more specific database adapter classes can extend this general class to connect to specific databases. for example: class mysqladapter extends databaseadapter.subclasses (children) inherit all of the actions and attributes from their superclasses (parents).
upvote downvote
Reply 

Advertisement
Advertisement
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader

Email Sent
We have sent an email to your address "" with instructions to reset your password.