OOPS Assignment Part B - Mani

OOPS Assignment Part B - Mani - OOPSAssignmentPartB...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
                                OOPS Assignment Part B Introduction: The document comprises of some of the most important features of Object  oriented   programming   and   C++.     This   helps   us   to   understand   the  functionalities with sample programs for the following: Inheritance Polymorphism Standard Template Library   Inheritance: In most of the situations we feel better if we have some thing already defined  and we need to just use it. Object orientation has given a very important  feature for code reusability in the form of   Inheritance.   The mechanism of  deriving a new class from an old one is called  Inheritance  some times also  known as   Derivation.   The following is  the terminology  which is used to  understand the concepts of Inheritance better: Base Class:  The class from which a new class is created is referred as  a Base class. Derived   Class:   The   class   that   is   derived   from   a   base   class   is  considered as a Derived class.   We can consider the relationship between a father and a son as inheritance.  As the son has the freedom to use all the features and comforts given from  the father and also can have his own features. Deriving a Class from a base class: The general syntax of deriving a class is: Class  derived-class-name : visibility-mode  base-class-name { ……//              ……//  members of derived class } Where vibsility mode can be any one of private, protected or public. But in  most of the cases we inherit the functionalities publicly unless we have any  critical business requirement. The following are the exceptions with respect to inheritance: Constructors and destructors of the base class are not inherited. Assignment operator is not inherited. Friend functions are not inherited. Types of Inheritance:
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
C++ supports the concept of reusability and inheritance in different forms.  Inheritance can be classified into different forms as mentioned below: Single Inheritance:  when a derived class has only one base class it is called  as single inheritance as shown in the figure below.                                                            Multiple Inheritance:     when a class is derived from more than one Base  class it is referred as Multiple Inheritance as shown I the figure below. Hierarchical Inheritance:  
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/22/2011 for the course CS 541 taught by Professor Dr.marcosrodrigues during the Spring '09 term at SUNY Buffalo.

Page1 / 11

OOPS Assignment Part B - Mani - OOPSAssignmentPartB...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online