Characteristics of Object-oriented programming.

 

Ans-:

Characteristics of Object-oriented programming

Object oriented programming is a programming that is associated with the Characteristics like Inheritance, Polymorphism, Abstraction, Encapsulation etc. and mainly emphasis on Class, Objects.

Object: Objects are basic run-time entities, and they are instances of a class these are defined user defined data types.

 

Laptop obj = new Laptop();

Laptop obj1 = new Laptop();

Laptop obj2 = new Laptop();

..............

 

obj.modelName = " Pavilion 15";

obj.manufacturerName = "HP";

obj.ram = "4 GB";

obj.memory = "1 TB";

obj.os = "Windows";

 

 

Class: A class is a user-defined data type that can use in our program, and it works as an object constructor, or a blueprint for creating objects.

 

 

public class Laptop

{

String modelName;

String manufacturerName;

String ram;

String memory;

String os;

 

 

void boot(){

 

 

}

}

 

Data abstraction: It provides only essential information to the outside world and hiding their background details, i.e., to represent the needed information in program without presenting the details.

For example, a database system hides certain details of how data is stored and created and maintained. Similar way, C++ classes provides different methods to the outside world without giving internal detail about those methods and data.

Encapsulation: Encapsulation is placing the data and the functions that work on that data in the same place. While working with procedural languages, it is not always clear which functions work on which variables, but object-oriented programming provides  framework to place the data and the relevant functions together in the same object.

Inheritance: Inheritance is the process by which objects of one class acquire the properties of objects of another class. It supports the concept of hierarchical classification. Inheritance provides re usability. Inheritance is the process of forming a new class from an existing class, existing class is known as base class, new class is known as derived class.

 

class Laptop extends Electronics

{

 

 

}

 

 

This is a very important concept of object-oriented programming since this feature helps to reduce the code size.

Polymorphism:

Polymorphism means ability to take more than one form. An operation may exhibit different behaviors in different instance behavior depends upon the types of data used in the operation.
Dynamic Binding: In dynamic binding, the code to be executed decided at runtime. C++ has virtual functions to support this.

Message Passing: Objects communicate with one another by sending and receiving information to each other. Message passing involves specifying the name of the object, the name of the function and the information to be sent.

 

class person

{

            char name[20];

            int id;

public:

            void getdetails(){}

};

 

int main()

{

person p1; // p1 is a object

 

 

 

 

 

Post a Comment

Thankyou

Previous Post Next Post