How do I modify my current program to incorporate objects, classes and inheritance? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do I modify my current program to incorporate objects, classes and inheritance?

How do I modify my current program to incorporate objects, classes and inheritance? https://code.sololearn.com/c9ZcyW0icRel/#cpp

29th Nov 2017, 7:25 PM
Trever Young
Trever Young - avatar
1 Answer
+ 1
Classes hold related data and functions (methods). Classes just hava atleast one responsibility, for example managing data. If it just holds data and has a few functions you might want to change it to a struct. For inheretence you have a class MotorVeichle. You can create a class such as Car and have it extend MotorVeichle Hope this helps
20th Jun 2018, 8:06 PM
Artem Katerynych
Artem Katerynych - avatar