Simplest Way to Learn Object Oriented Programming

SIMPLEST WAY TO LEARN OOP

OOP1.jpg

What is a Class?

A class is a group of similar methods and variables. A class contains definitions of variables, methods etcetera in most cases.

or

A class is simply a representation of a type of object. It is the blueprint that describes the details of an object. A class contains member variables, methods and properties.

OOP2.jpg
What is an Object?

An instance of a class is known as an object. Using that object we can access the properties and methods of a class. The set of activities that the object performs defines the object's behavior. For example a Student (object) can provide the name or address.

In pure OOP terms an object is an instance of a class.

OOP3.jpg

What is Encapsulation?

"Encapsulation is a process of binding data members (variables and properties) and member functions (methods) into a single unit". And a class is the best example of encapsulation.

OOP4.jpg

What is Inheritance?

Inheritance enables you to create a new class that inherits the properties from another class or base class and the class that inherits those members is called the derived class. So the derived class has the properties of the base class and its own class properties as well.

OOP5.jpg
What is Polymorphism?

In simple words we can say that whenever we are overloading the methods of a class it is called polymorphism. Or you can say polymorphism is often expressed as "one interface, multiple functions".

OOP6.jpg

What is an abstraction?

When we drive a car we often need to change the gears of the vehicle but we are not concerned about the inner details of the vehicle engine. What matters to us is that we must shift a gear, that's it. This is abstraction; show only the details that matter to the user.

Abstraction is used to manage complexity. Software developers use abstraction to decompose complex systems into smaller components.

OOP7.jpg
.