- Why do we need classes, why can’t we just use structs?**
advantage of using classes is that they support inheritance and polymorphism, which allows for more flexible and modular code. Structs, on the other hand, do not support inheritance or polymorphism and are limited to simple data structures.
Class can be used for a huge amount of data,. Strict is used for smaller amounts of data.
- What are methods?
Functions that belong to a class type are called member functions. Example is day, and month for the struct or class " date ".
- How would you define a class?
A class is a group of objects that share common properties and behavior.
A class is like a blueprint for an object.
- What is an object?
An Object is an instance of a class. Class is a blueprint or template from which objects are created.
Object is a real world entity such as pen, laptop, mobile, bed, keyboard, mouse, chair etc.