Презентация Nheritance, polymorphism, and virtual functions онлайн
На нашем сайте вы можете скачать и просмотреть онлайн доклад-презентацию на тему Nheritance, polymorphism, and virtual functions абсолютно бесплатно. Урок-презентация на эту тему содержит всего 48 слайдов. Все материалы созданы в программе PowerPoint и имеют формат ppt или же pptx. Материалы и темы для презентаций взяты из открытых источников и загружены их авторами, за качество и достоверность информации в них администрация сайта не отвечает, все права принадлежат их создателям. Если вы нашли то, что искали, отблагодарите авторов - поделитесь ссылкой в социальных сетях, а наш сайт добавьте в закладки.
Презентации » Устройства и комплектующие » Nheritance, polymorphism, and virtual functions
Оцените!
Оцените презентацию от 1 до 5 баллов!
- Тип файла:ppt / pptx (powerpoint)
- Всего слайдов:48 слайдов
- Для класса:1,2,3,4,5,6,7,8,9,10,11
- Размер файла:765.95 kB
- Просмотров:63
- Скачиваний:0
- Автор:неизвестен
Слайды и текст к этой презентации:
№9 слайд
![Class Access Specifiers](/documents_6/2c9a7e7eed55da72d768496fab4a4789/img8.jpg)
Содержание слайда: Class Access Specifiers
public – object of derived class can be treated as object of base class (not vice-versa)
protected – more restrictive than public, but allows derived classes to know details of parents
private – prevents objects of derived class from being treated as objects of base class.
№14 слайд
![Constructors and Destructors](/documents_6/2c9a7e7eed55da72d768496fab4a4789/img13.jpg)
Содержание слайда: Constructors and Destructors in Base and Derived Classes
Derived classes can have their own constructors and destructors
When an object of a derived class is created, the base class’s constructor is executed first, followed by the derived class’s constructor
When an object of a derived class is destroyed, its destructor is called first, then that of the base class
№18 слайд
![Passing Arguments to Base](/documents_6/2c9a7e7eed55da72d768496fab4a4789/img17.jpg)
Содержание слайда: Passing Arguments to
Base Class Constructor
Allows selection between multiple base class constructors
Specify arguments to base constructor on derived constructor heading:
Square::Square(int side) : Rectangle(side, side)
Can also be done with inline constructors
Must be done if base class has no default constructor
№25 слайд
![Problem with Redefining](/documents_6/2c9a7e7eed55da72d768496fab4a4789/img24.jpg)
Содержание слайда: Problem with Redefining
Consider this situation:
Class BaseClass defines functions x() and y(). x() calls y().
Class DerivedClass inherits from BaseClass and redefines function y().
An object D of class DerivedClass is created and function x() is called.
When x() is called, which y() is used, the one defined in BaseClass or the the redefined one in DerivedClass?
№29 слайд
![Polymorphism and Virtual](/documents_6/2c9a7e7eed55da72d768496fab4a4789/img28.jpg)
Содержание слайда: Polymorphism and Virtual Member Functions
Virtual member function: function in base class that expects to be redefined in derived class
Function defined with key word virtual:
virtual void Y() {...}
Supports dynamic binding: functions bound at run time to function that they call
Without virtual member functions, C++ uses static (compile time) binding
№45 слайд
![Abstract Base Classes and](/documents_6/2c9a7e7eed55da72d768496fab4a4789/img44.jpg)
Содержание слайда: Abstract Base Classes and Pure Virtual Functions
Pure virtual function: a virtual member function that must be overridden in a derived class that has objects
Abstract base class contains at least one pure virtual function:
virtual void Y() = 0;
The = 0 indicates a pure virtual function
Must have no function definition in the base class
№46 слайд
![Abstract Base Classes and](/documents_6/2c9a7e7eed55da72d768496fab4a4789/img45.jpg)
Содержание слайда: Abstract Base Classes and Pure Virtual Functions
Abstract base class: class that can have no objects. Serves as a basis for derived classes that may/will have objects
A class becomes an abstract base class when one or more of its member functions is a pure virtual function
№48 слайд
![Multiple Inheritance Problem](/documents_6/2c9a7e7eed55da72d768496fab4a4789/img47.jpg)
Содержание слайда: Multiple Inheritance
Problem: what if base classes have member variables/functions with the same name?
Solutions:
Derived class redefines the multiply-defined function
Derived class invokes member function in a particular base class using scope resolution operator ::
Compiler errors occur if derived class uses base class function without one of these solutions
Скачать все slide презентации Nheritance, polymorphism, and virtual functions одним архивом:
Похожие презентации
-
4. Java OOP. 4. Inheritance and Polymorphism
-
Mathematical functions, characters, and strings. Introduction to Java Programming
-
Analysis and Design of Data Systems. Functional Dependencies and Normalization Theory (Lecture 15)
-
Development and Simulation
-
System analysis and decision making Decision Trees
-
ВКР: Разработка ANDROID приложения с использованием MVP архитектуры
-
5B070500 «Mathematical and Computer Modeling» Образовательные программы
-
Software Development Life Cycle and Methodologies
-
Программирование. Program understanding
-
Языки программирования. Модуль random. Генерация случайных чисел