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

Lập trình hướng đối tượng: Session 7 - 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 (80.56 KB, 7 trang )

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

Session 7 –

<b>Inheritance </b>



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

Session 7 - Inheritance 2/28


Objectives



• <b>Derived Classes</b>


– Terminology
– Derivation


– Protected Access


• <b>Derived Functions</b>


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

Inheritance



• An inheritance is a relationship where
objects share a common structure: the


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

Session 7 - Inheritance 4/28


Inheritance



• In object-oriented programming, we


describe inheritance in terms of classes.
Inherited classes share a common


structure. We say that one class is a kind
of another class.



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

<b>Terminology(1)</b>



• The derived class inherits the structure of
a base class.


• For example, a mammal inherits the


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

Session 7 - Inheritance 27/28


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

Summary



• <b>Derived Classes</b>
– Terminology


– Derivation


– Protected Access


• <b><sub>Derived Functions</sub></b>


– Shadowing
– Constructors
– Destructors


</div>

<!--links-->

×