Features of OOPs, Object-oriented Programming?

All QuestionsCategory: Cpp LanguageFeatures of OOPs, Object-oriented Programming?
Anonymous asked 3 years ago
1 Answers
Anonymous answered 3 years ago

The features of OOPs are:
 
01. Encapsulation: In OOP data and functions are combined into one single entity. This process of combining the data and associated functions into one single entity is called encapsulation.
02. Data security: Since data and functions are combined into one single entity, data can be accessed and processed only by the associated member functions i.e., only the member function have right to change the data variables. The functions that are not member functions do not have right to change the data variables and hence the data is secure.
03. Data initialization: In the C language, the programmer has to explicitly call the initialization functions. But, in C++, a guaranteed and automatic initialization of data variables to the desired values is done. This can be done using the concept of constructors in C++.
04. Inheritance: Inheritance is the ability to create new objects from existing objects. The existing object is called the base object and the new object which is created using the existing objects is called the derived class. Click here to read in detail about inheritance. The existing object can be given general common characteristics while the derived object can be given more specific characteristics. This allows code re-usability i.e., the code in the base object need not be duplicated in the derived object.
05. Polymorphism: In OOP two or more functions can have the same name which is not possible in C. This is called function overloading. The same operator can have different meanings in different places. For example, the operator << is left shift operator. It can also be treated as an insertion operator. So, the operator << has more than one meaning. This is called operator overloading. Thus, polymorphism is the phenomenon where an entity can exist in two or more forms. Polymorphism is the phenomenon where an entity can exist in two or more forms. Polymorphism is achieved using the overloading of functions and overloading of operators in C++.