Tải bản đầy đủ (.pdf) (7 trang)

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

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (70.51 KB, 7 trang )

<span class='text_page_counter'>(1)</span><div class='page_container' data-page=1>

Session 8-Inheritance(2)



<b>Derived Classes with Depth</b>


<b>Multiple Inheritance</b>



</div>
<span class='text_page_counter'>(2)</span><div class='page_container' data-page=2>

Objectives



• <b>Derived Classes with Depth</b>


– Constructors and Destructor
– Copy Constructor


– Assignment Operator
• <b><sub>Multiple Inheritance</sub></b>


– Virtual Inheritance


• <b>Abstract Base Classes</b>


</div>
<span class='text_page_counter'>(3)</span><div class='page_container' data-page=3>

<b>Derived Classes with Depth</b>



• Constructor(s), copy constructor,



assignment operator and destructor of


derived class called ?



</div>
<span class='text_page_counter'>(4)</span><div class='page_container' data-page=4></div>
<span class='text_page_counter'>(5)</span><div class='page_container' data-page=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


</div>
<span class='text_page_counter'>(6)</span><div class='page_container' data-page=6>

Virtual Operators



• Declaration syntax:


</div>
<span class='text_page_counter'>(7)</span><div class='page_container' data-page=7>

Summary



• <b>Derived Classes with Depth</b>


– Constructors and Destructor
– Copy Constructor


– Assignment Operator
• <b><sub>Multiple Inheritance</sub></b>


– Virtual Inheritance


• <b>Abstract Base Classes</b>


– Pure Virtual Functions
– Abstract Base Classes
– Virtual Operators


</div>

<!--links-->

×