chapter 1 (features of oops: part1)
Oops is a programming language style that is focused on object.
Important features of oops .
1.Abstraction .
2.Encapsulation.
3.Inheritance.
4. Polymorphism.
Abstraction
Data abstraction refers to providing only essential information to outside world and hiding their backgrount details .
Real life example of a TV ,which you can turn on and off ,change the channel ,adjust the volume and external component such as a speaker ,VCRs and DVD players ,but you do not know its internal details ,that is ,how it receives signals over the air or through a cable, how it them, and finally displays them on the screen.
In C++, classes provides great level of data abstraction.They provide sufficient public methods to the outsideworld to play with the functionality of the object and tomanipulate object data, i.e., state without actually knowing how class has been implemented internally.
In C++, we use classes to define our own abstract data types (ADT). You can use the cout object of class ostream to stream data to standard output .you don't need to understand how cout displays the text on the user's screen. You need to only know the publicinterface and the underlying implementation of ‘cout’ is free to change.
Encapsulation
Encapsulation is an Object Oriented Programming concept that binds together the data and functions that manipulate the data, and that keeps both safe from outside interference and misuse. Data encapsulation led to the important OOP concept of data hiding. Data encapsulation is a mechanism of bundling the data, and the functions that use them and data abstraction is a mechanism of exposing only the interfaces and hiding the implementation details from the user.
Inheritance
.Inheritance Feature that enables the characteristics or properties of a parent to reach its child .C++ supports inheritance A class can inherit one or more classes .Inherited class is called as parent class or super class or base class .Class that inherits a parent class is called as child class or sub class or derived class.
Polymorphism
Poly – Many
Morph – Form
Polymorphism is the characteristic that enables an entity to exist in more than one form C++ supports function overloading and operator overloading to implement polymorphism
Comments
Post a Comment