Topics
Operating System
- Introduction to Operating System (OS)
- Idea of an Operating System
- Windows NT
- LINUX
- File Systems and Its types
- File Operations
- Access Methods and its types
- Allocation Methods
- Concepts Related to Process Management
- Concepts related to memory management
- Basics of Graphical User Interface (GUI)
- Access and Security Aspects of O.S.
Data Structures
C++ Programming
- Introduction to C++ Programming
- Idea Behind Object-Orientated Programming
- Object-orientated programming approach
- Object-Oriented Terms and Concepts
- Classes and Objects
- Constructors and Destructors
- Functions in C + +
- Arrays in C++
- Pointers in C++
- References in C++
- Strings in C++
- Inheritance
- Virtual functions and polymorphism
- Friends in C++
- Operator overloading and type conversions
- Files and Stream
HyperTex Markup Language (HTML)
- Introduction to Inheritance
- Single Inheritance
- Multiple Inheritance
- Multilevel Inheritance
- Hierarchical inheritance
- Hybrid inheritance
Notes
Inheritance stands for derivation. The mechanism of deriving a new class from an old one is called inheritance. The old class is referred to as the base class and new one is called the derived class.
Types of Inheritance
a) A derived class with only one base class is called single inheritance.
b) A derived class with several base classes is multiple inheritance.
c) When more than one class is derived from one base class then it is hierarchical inheritance.
d) The mechanism of deriving a class from another 'derived class' is known as multilevel inheritance.
e) When there is more than one type of inheritance used, it is called hybrid inheritance.
Defining derived classes
A derived class is defined by specifying its relationship with the base class. The general form is:
class derived-class-name : visibility -mode base-class-name
{
- - -members of derived class
} ;
The colon indicates that the derived class is derived from the base class. The optional visibility mode (private, protected, or public) defaults to private and specifies how base class features are inherited. In private inheritance, base class public members become private in the derived class. In public inheritance, they remain public. Private members are inaccessible to derived classes; protected members are accessible only within derived classes.
Virtual base classes
The' child' has two direct bases 'parent 1' and 'parent 2' which themselves have a common base class 'grandparent'. Here 'child' would have duplicate sets of the member inherited from 'grandparent' via 'parent1' and again via 'parent 2'. This introduces ambiguity. It can be avoided. The duplication of inherited members due to these multiple paths can be avoided by making the common base class as virtual base class.
Constructors in derived classes
It is required for the derived class to have a constructor and send arguments to the base class constructor if the base class has a constructor with one or more parameters. When a constructor is present in both the base and derived classes, the base constructor is used first, followed by the derived class constructor.
Inheritance:
Inheritance in Java allows a class to inherit properties and methods from another class, thus allowing the reusability of code between various methods of different class. This establishes a parent-child relationship between classes.
Visibility Mode of Inheritance
A base class can be derived by another class by using only the public mode of inheritance.
Public: By using the public mode, the Public and Protected members of the Base class act as the Public members of the derived class. The syntax used in Public Inheritance is given below:
public<derived class>extends<base class>
Using Data Members Protected in the Base Class
Class members are declared private for restricted access within the class. A class member declared private cannot be accessed by any of the derived class. For inheritance, base class members are declared protected, allowing direct access by derived classes.