Oop question

Oop question

by Md. Musabbir Hossain -
Number of replies: 1

1/ A class defines object properties including a valid range of values and default value. A class also describe object behaviour. An object is a member or an instanse of a class.


2/ Suppose i want to bought a mobile phone. So mobile phone is a class. 

And we know there are many brands of mobile phone. These are samsung,xiaomi,poco,1+ etc. So these each and every brand is a object of this mobile phone.

In reply to Md. Musabbir Hossain

Re: Oop question

by Abdullah Al Rafi -
The following are the differences between classes and objects:

1. A class is an object template. But an instance of a class is an object.
2. There is no need to allocate memory while establishing a class. However, memory allocation is necessary for objects.
3. First and foremost, the class must be declared. But you can make an item as many times as you like.
4. Class cannot be changed. But things can.
5. A logical entity is a class. However, objects are actual things
6. A class keyword is used to declare a class. But the "new" keyword creates objects.
7. Data and method are joined together to form a single entity using classes. However, objects function like class variables.

For example, we can consider a car as a class that has characteristics like steering wheels, seats, brakes, etc.