انت هنا الان : شبكة جامعة بابل > موقع الكلية > نظام التعليم الالكتروني > مشاهدة المحاضرة

Inheritance

Share |
الكلية كلية العلوم للبنات     القسم قسم الحاسبات     المرحلة 2
أستاذ المادة حسنين علي عبيس عبود آل عيسى       13/03/2019 18:29:21
Object-oriented programming is based on four important aspects:
Encapsulation, abstraction, inheritance, and polymorphism. Inheritance is a powerful
way to reuse attributes and is a stepping stone towards polymorphism.
In this lesson, you find out about
? Inheritance in the context of programming
? The C++ syntax of inheritance
? public , private , and protected inheritance
? Multiple inheritance
Basics of Inheritance
In programming parlance, we are often faced the situations where components being
managed have similar attributes, differing minutely in details or in behavior. One way
to solve this problem is to make each component a class where each class implements
all attributes, even re-implementing the common ones. Another solution is using
inheritance to allow classes that are similar to derive from a base class that
implements common functionality, overriding this base functionality to implement
behavior that makes each class unique. The latter is often the preferred way. Welcome
to inheritance in our world of object-oriented programming.
Inheritance and Derivation Figure (Inheritance between classes) shows a diagrammatic relationship between a
base class and its derived classes. It might not be easy right now to visualize what a
base class or a derived class could be; try to understand that a derived class inherits
from the base class.
Note: This lesson starts with public inheritance to understand the concept of
inheritance and the most frequent form of inheritance before moving on to private
or protected inheritance.
To make understanding this concept easy, think of a base class Bird. Classes are
derived from Bird are class Crow, class Parrot, or class Kiwi. A class Bird would define
the most basic attributes of a bird, such as is feathered, has wings, lays eggs, can fly

المادة المعروضة اعلاه هي مدخل الى المحاضرة المرفوعة بواسطة استاذ(ة) المادة . وقد تبدو لك غير متكاملة . حيث يضع استاذ المادة في بعض الاحيان فقط الجزء الاول من المحاضرة من اجل الاطلاع على ما ستقوم بتحميله لاحقا . في نظام التعليم الالكتروني نوفر هذه الخدمة لكي نبقيك على اطلاع حول محتوى الملف الذي ستقوم بتحميله .
الرجوع الى لوحة التحكم