Lập trình hướng đối tượng: Session 8 - Inheritance

7 8 0
Lập trình hướng đối tượng: Session 8 - Inheritance

Đang tải... (xem toàn văn)

Thông tin tài liệu

• If we don't define a copy constructor for the derived class, the compiler inserts one that. performs and shallow copy[r]

(1)

Session 8-Inheritance(2)

Derived Classes with Depth Multiple Inheritance

(2)

Objectives

Derived Classes with Depth

– Constructors and Destructor – Copy Constructor

– Assignment Operator • Multiple Inheritance

– Virtual Inheritance

Abstract Base Classes

(3)

Derived Classes with Depth

• Constructor(s), copy constructor,

assignment operator and destructor of derived class called ?

(4)(5)

Copy Constructor(1)

• A derived class has its own copy constructor

• Derived class copy constructor is distinct from the copy constructor of the base class

• If we don't define a copy constructor for the derived class, the compiler inserts one that

(6)

Virtual Operators

• Declaration syntax:

(7)

Summary

Derived Classes with Depth

– Constructors and Destructor – Copy Constructor

– Assignment Operator • Multiple Inheritance

– Virtual Inheritance

Abstract Base Classes

– Pure Virtual Functions – Abstract Base Classes – Virtual Operators

Ngày đăng: 09/03/2021, 06:26

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan