Object Oriented Interview Question -Benefits Of Inheritance

No.of Views1263
Bookmarked0 times
Downloads 
Votes0
By  jalpesh   On  09 Jun 2010 08:06:23
Tag : OOP , General
Through inheritance we can eliminate the redundant code and extend the user of the existing classes.
emailbookmarkadd commentsprint

Images in this article missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at info@codegain.com

 

Introduction

Through inheritance we can eliminate the redundant code and extend the user of the existing classes.We can build program from the standard working modules that can communicate with the one another rather then having start writing code from beginning.It is possible to have multiple instances of objects of class without any interface.It is easy to partion the work.
Object oriented system can be easily upgraded from the small to the large systems.Easily modifying and extending implementations of components without having to recode everything from scratch.


1) Objects:
Object are the basic run time entities in the object oriented system. They may represent a person, a palace, a bank account, a table data or anything that a program can handle.


2) Classes:
A class encloses both the data and function that operate on the data into a single unit.

3) Data abstraction and Encapsulation:
The wrapping of data and function in a single unit is know as encapsulation. It is a mechanism that associate into the single unit and keeps them safe from external interference and misuse.
Abstraction refers to the act of representing essential features without including the background details or explanations.

4) Inheritance:
Inheritance is the process by which objects of one class acquire the properties of objects of another class.

5) Polymorphism:
Polymorphism means ability to take more then one form. For example as operation may execute different behaviour in different conditions. The behaviour depends on type of data used in operations.

6) Dynamic Binding:
Binding refers to the linking of a procedure call to be executed in response to the call. Dynamic binding means that the code associated with a given procedure call is not know until the time of call at run time. Virtual functions are the best examples of dynamic binding.

7) Message Communications:
An object oriented program consists of a set of objects that communicate with each other. Object
communicate with one another by sending data receiving information much same way as people passes messages to one another. A message for an object is a request for the execution of a procedure and therefore will invoke function in the receiving object that generates desire results.

8) Extensibility:
It is a feature which allows the extension of the functionality of the existing software components.

9) Delegation:
It is a alternative to the class inheritance. Delegation is a way of making object composition as powerful as inheritance. In delegation two objects are invoked in handling a request, receiving object delegates operation to its delegate. This is analogues to the child class sending a request to the parent class.

10) Generaticity:
It is a technique for defining software components that have more then one interpretation depending on the typoe of parameters.

Diffrent Type Of Inheritance

Following are different type of inheritance..
1) Single Inheritance:
Derivation of class from only one base class is called single inheritance.
2) Multiple Inheritance:
Derivation of class from several base class is called multiple inheritance.
3) Hierarchical Inheritance:
Derivation of several classes from a single class is called hierarchical inheritance.
4) Multilevel Inheritance:
Derivation of a class from another derived class is called multiple inheritance.
5) Hybrid Inheritance:
Derivation of a class involving more then one form of inheritance is called hybrid class.
6) Multi path Inheritance:
Derivation of a class from another derived classes which are derived from the same base class is called multi path inheritance

Member of class

Definitions Of Object: An object is combination and collection of data and code designed to emulate a physical abstract enmity.You can create number object of class. The properties, Variable and Methods define in class are called Members of class.


Private Member Of Class: Private member of a class have strict access control Only the member function of same class can access this members.
Protected Member of Class: A Protected member is accessible to member of its own calls and to any of the class member in a derived class.
Public Member Of Class: A public member of class can be accessible from any where.
Public and Private Static Member Of a Class: The static member of a class can be access without creating a object of class. While to access other member of class you have to create a object of class. The public static member can be accessed using access specifier while private static member can be accessed only the member functions.

Inheritance and Member Accessibility

A private member is accessible only to members of the class in which private member is declared. They cannot be inherited,A private member of the base class can be accessed in the derived class through the member of the base class.A protected member is accessible by member of its own class and to any of the class member in a derived class.

 
Sign Up to vote for this article
 
About Author
 
jalpesh
Occupation-Software Engineer
Company-DotNetJaps
Member Type-Expert
Location-India
Joined date-08 May 2010
Home Page-http://www.dotnetjalps.com
Blog Page-http://www.dotnetjalps.com
I am jalpesh vadgamaa an Microsoft MVP for Visual C# and BrainBench Certified ASP.NET Developer having experience of five year in Microsoft .NET Technology.I am working as Project Leader in Mid Size company.My work area comprises of Enterprise Level projects using ASP.NET and other Microsoft .NET Technologies.Please feel free to contact me for any queries via posting comments on my blog I will try to reply as early as possible.
 
 
Other popularSectionarticles
    Object-oriented design is a programming paradigm that began in the late 60's as software programs became more and more complex.
    Published Date : 18/Jun/2010
    how we could implement encapsulation object oriented concept in C#
    Published Date : 16/Feb/2010
    In this article I will write the code first about the classes and explain you later how its achieved in c#.
    Published Date : 19/Jun/2010
Comments
There is no comments for this articles.
Leave a Reply
Title:
Display Name:
Email:
(not display in page for the security purphase)
Website:
Message:
Please refresh your screen using Ctrl+F5
If you can't read this number refresh your screen
Please input the anti-spam code that you can read in the image.
^ Scroll to Top