Тёмный
No video :(

28 C++ Inheritance , Single Inheritance zoom | C++ Programming Tutorial for beginners | cpp | C plus 

tech fort
Подписаться 10 тыс.
Просмотров 15
50% 1

#Inheritance in C ++ :
- inheritance is nothing but accessing one class properties(data members and member functions) into another class.
- Inheritance is the process in which one object acquires all the properties(data members) and behaviors(member functions) of its parent object automatically.
- child/derived/sub class
- parent/base/super class :
- The class which inherits the members/properties of another class is called as child/derived/sub class, and the class whose members/properties are inherited is called as base/parent/super class.
Advantages: Code Re usability
class SuperClass{
//body
}
Derived Class:
A derived class is defined as the class derived from the base class.
class DerivedClass::visibility_mode SuperClass{
// body of child/derived class
}
DerivedClassname :
visibility_mode : access spefiers
Note:
- When the base class is privately inherited by the derived class, public members of the base class becomes private members of the derived class. therefore the public memebers of the base class are not accesible by the objects of derived class, so derived/sub class objects by can access the members of its own class only.
- When the base class is publicly inherited by the derived/child/sub class, public members of the base class also becomes public members of the child/derived class. therefore public members of the base class are accessible by the objects of the derived/sub class as well as by the members functions of the base class also.
- Note : default mode of visiblity is private.
- private members of the base class never be inherited.
Types of ineritance:
--------------------
Single inheritance
Multiple inheritance
hierarchical
multilevel inheritance
hybrid inheritance
1)Single inheritance:
--------------------
Single inheritance in which a derived class is inherited form only one base/parent class

Опубликовано:

 

5 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии    
Далее
small vs big heart 💖 #tiktok
00:13
Просмотров 5 млн
8 DBMS SQL  2020 06 14 09 20 24
1:19:35
Просмотров 138
If __name__ == "__main__" for Python Developers
8:47
Просмотров 400 тыс.