Object - Any entity that has a state and behavior is known. It is an instance of the class.
Class - The collection of objects is called class.
Inheritance - When one object acquires all the properties and behaviors of the parent object i.e. known as inheritance.
Polymorphism - When one task is performed by different ways i.e. known as polymorphism.
Abstraction - Hiding internal details and showing functionality is known as abstraction
Encapsulation - Binding (or wrapping) code and data together into a single unit is known as encapsulation
Code for Creating Objects and Classes in C++:
class Student {
public:
int id;//data member (also instance variable)
string name;//data member(also instance variable)
};
int main() {
Student s1; //creating an object of Student
s1.id = 201;
s1.name = "Board Infinity";
cout<<s1.id<<endl;
cout<<s1.name<<endl;
return 0;
}