1. Trang chủ
  2. » Trung học cơ sở - phổ thông

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

7 8 0

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

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 7
Dung lượng 70,51 KB

Nội dung

• 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

w