GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Concepts  >  OOPS
Go To First  |  Previous Question  |  Next Question 
 OOPS  |  Question 20 of 68    Print  
how to implement the runtime polymorphism using c++. examples.

  
Total Answers and Comments: 2 Last Update: September 15, 2008     Asked by: kavitha 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
August 03, 2006 07:26:38   #1  
AvinashChaturvedi Member Since: August 2006   Contribution: 4    

RE: how to implement the runtime polymorphism using c+...

Hi To All

First We Know that polymorphism means Single interface Multiple Methods so whenever we want to implement this into our program we use it in form of function overloading and operator overloading but these both perform static or compile time polymorphism so for the runtime polymorphism we must perform these operations

1 . implement a base class with some functions with virtual keyword on witch u want to perform polymorphism

2. implement a drived class from this base class and also implement all the functions on which u want to perform polymorphism here a important point is that the signature of all the functions must be same in base and drived classes but virtual keyword not used in drived class.

3. implement a programe which you create a reference for base class and an object for base class. an object for drived class also created .

4. now on the runtime if u store the address of base class object into the ref of base class then function defination from base class will be called and when ref contain an address of drived class object it called the drived class version for that function.

Regards

Avinash chaturvedi ( Avi )


 
Is this answer useful? Yes | No
September 15, 2008 13:35:48   #2  
rajani_vaddepalli15 Member Since: June 2008   Contribution: 19    

RE: how to implement the runtime polymorphism using c++. examples.
ans: using Templates
 
Is this answer useful? Yes | No

 Related Questions

There are three main principals of oops which are called Polymorphism, Inheritance and Encapsulation  
Latest Answer : Abstraction: Involves extracting only the relevant information.Encapsulation: Involves packaging one or more components together.Inheritance: Is a process of creating a new class by adding some features to an existing class.Polymorphism: Is an ability ...
Tags : OOPS

The meaning of Polymorphism is something like one name many forms. Polymorphism enables one entity to be used as as general category for different types of actions. The specific action is determined by 
Latest Answer : Polymorphisam: It can be catagorized into three ways.1. Method Overloading 2. Method Over-riding3. Interface methods implemented differently in different ways in sub-classes.Overloading: Define methods with same name , same return type with different ...

From a practical programming viewpoint, polymorphism exists in three distinct forms in Java: Method overloading Method overriding through inheritance Method overriding through the Java interface  
Latest Answer : Method OverloadingMethod OverridingOperator OverloadingThese are the different forms of Polymorphism in Java. ...

Latest Answer : ans: using Templates ...
Read Answers (2) | Asked by : kavitha

Latest Answer : Interfaces, like classes, define a set of properties, methods, and events. But unlike classes, interfaces do not provide implementation. They are implemented by classes, and defined as separate entities from classes.

Describe why Java supports only runtime polymorphism? 
Latest Answer : The three ways of polymorphism in Java are method overloading, method overridding and method overridding by extending an class. All these results come true when we run our class which is overloading or overidding any method since we run methods at runtime. ...


 Sponsored Links

 
Related Articles

Concepts of Object-Oriented Programming

Object Oriented JavaScript In this chapter you ll learn about OOP Object Oriented Programming and how it relates to JavaScript As an ASP NET developer you probably have some experience working with objects and you may even be familiar with concepts such as inheritance However unless you re already a
 

OOPS Tutorials

Object oriented programming OOP is a computer science term used to characterize a programming language that began development in the 1960’ s The term object oriented programming’ was originally coined by Xerox PARC to designate a computer application that describes the methodol
 

SOA Concepts

SOA Concepts Today the concept of Service Oriented Architecture has become ubiquitous Evidence from recent years establish that SOA is not just about hype but a part of every major Business environment The truth is Service Oriented Architecture can be beneficial to Business only when it is utilized
 

C++ Polymorphism

C Polymorphism Introduction Polymorphism is the ability to use an operator or function in different ways Polymorphism gives different meanings or functions to the operators or functions Poly referring to many signifies the many uses of these operators and functions A single function usage or an oper
 

The Interview Snafu

How to turn someone else’s mistake to your advantage Your dream job is about to become reality. A recruiter gave you the heads up about the perfect position at Humungous Conglomerate, Inc. You went through five interviews as well as a battery of psychological tests mandated by their HR de
 

Winning a Job Interview with a Winning Resume

Does your resume unlock your potential, take your skills to the highest level and win you the interview and the job you want now? The job market today is highly competitive and even if you think you have what it takes to get an interview you won’t get over the line without a polished, prof
 

WinRunner Programming Concepts

If you want to create WinRunner scripts that are highly efficient, there are important programming concepts that you will want to become familiar with. Understanding these concepts will provide you with a large number of key benefits. In addition to understanding these concepts, you must also learn
 

Importance of Proper English during Job Interview

Importance of Proper English during Job Interview Your job interview is crucially important and it will determine whether or not you will get the job Depending on the type of job you re going for it is very important for you to use proper English In most cases jobs which offer higher salaries will h
 

Web 2.0 Concepts

Web 2 0 Concepts There are a number of important innovations which are expected to play a pivotal role in the introduction of Web 2 0 Some of these innovations are applications that are web based One of the most powerful tools that has allowed this is Ajax mosgoogle Ajax is powerful because it has n
 

HR Interview - HR Interview Mistakes You Will Want To Avoid

HR Interview Mistakes You Will Want To Avoid The job interview can be a stressful process This is especially true for those who are going after a competitive position Your nonverbal communication combined with the answers you give during the interview will determine if you are hired mosgoogle While
 

About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape