OOPs Concepts

Hi,

In this post we will be discussing about the concepts of OOPs…

These concepts are very important to be known when any fresher is going to attending an interview. So lets go through the OOPs Concepts…

1. What is a Class?

A class is a template / skeleton / blueprint for creating an object.

 

2. What is an Object?

  • An Object is an entity that has properties for validations, methods for functionality and events for depicting the change of state.
  • Every object has the data and behavior with which they are differed. Data associated at any given instance of time is the state of an object.

 

3. What is a Component?

A ready to use third party object can be called as a Component. It can be replaced without any changes in the application. A component is generally used by a programmer as an object.

 

An application can be called as a collection of related objects exchanging messages with each other.

 

Loosely coupled objects are better than tightly coupled objects i.e. the lesser the information given to other objects the better it is as the objects are loosely coupled the dependencies are less and stronger security.

 

Every object oriented language should have three features

  • Encapsulation
  • Inheritance
  • Polymorphism

 

Encapsulation: Binding of data and behavior i.e. functionality of an object within a secured and controlled environment is encapsulation. Best example for encapsulation is a class.

 

Inheritance: The Process of acquiring the existing functionality of the parent and with new added features and functionality by a child object is called inheritance.

The advantages of inheritance are Generalization, Extensibility and Reusability.

For example: A calculator is a generalized form of mathematical operations where as a Scientific calculator is an Extended and Specific form.

 

Polymorphism: An object in different forms and in each form it exhibits the same functionality but implemented in different ways.

For example: A man who knows more than one language can speak any language he knows. Here the functionality is speech and person is the object.

A faculty can take a form of Java Faculty or MS.NET faculty and in both the forms he teaches, but what he teaches differs. Here functionality is teach and faculty is the object.

Always have your basics strong that is when you can achieve anything you want.

That is the reason we are sharing this important basics with you, which are very essential to be known.

Please do comment to our posts.

Thank you, and stay connected……