C++ का परिचय
C++ एक Object Oriented Programming(OOP) Language है इसको Bjarne Stroutrup ने AT & T Bell Lab, Murry hill, new Jersey USA में 1979 में बनाया था । C++ को C Language से derive किया है ।
C++ Program
Object(1)
Object(2)
Object(3)
Object Oriented Programming(OOP) :
OOPs is a programming methodology that focuses on objects and it is based on four principals
1. Abstraction 2. Encapsulation 3. Inheritance 4. Polymorphism
Features of OOPs
- Class
- Object
- Abstraction
- Encapsulation
- Inheritance
- Polymorphism
- Modularity
Class
A class is an abstract idea that defines characteristics and behaviour of an object.
Or
A Class is an collection of data member and member functions. Member functions operates on data.
Abstraction ( Data Hiding)
The Concept of hiding internal details of an object na showing only external behaviour is called abstraction.
Data abstraction - Refers to the hiding of data.
Encapsulation
The wrapping up of data with functions/code is encapsulation.
Abstraction is always implemented by encapsulation.
Inheritance
It refer to the derivation of new class(es) from the existing class(es).
Inheritance is a process by which one object acquires the properties of another object.
उपरोक्त diagram में यदि एक claas को base class कहेगे तो उससे derive क्लास को derived class कहेगे
यदि एक class को parent क्लास कहेगे तो उससे derive क्लास को child क्लास कहेगे
यदि एक class को super क्लास कहेगे तो उससे derive क्लास को sub क्लास कहेगे
यदि एक class को old क्लास कहेगे तो उससे derive क्लास को new क्लास कहेगे
Types of Inheritance
1. Single level
2. Multilevel
3. Multiple.
4. Hierarchical or Tree
5. Hybrid
1. Single Level Inheritance
1. Multi Level Inheritance
Polymorphism (Greek word)
Poly - Many
Morphism - Form
It means one thing with many forms
No comments:
Post a Comment