answersLogoWhite

0

What is virtual polymorphism?

Updated: 8/17/2019
User Avatar

Wiki User

14y ago

Want this question answered?

Be notified when an answer is posted

Add your answer:

Earn +20 pts
Q: What is virtual polymorphism?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How is run time polymorphism accomplished?

Through inheritance and virtual functions.


How can be different forms of polymorphism achieved?

Implicit Parametric PolymorphismSubtype PolymorphismExplicit Parametric Polymorphism


Why run time polymorphism is dynamic and compile time polymorphism is static?

The simple answer is that compile-time polymorphism occurs at compile time while runtime polymorphism occurs at runtime. The actual answer is that compile-time polymorphism results in the compiler generating source code on your behalf while runtime polymorphism relies on function pointers or virtual methods to determine the next instruction at runtime. Compile-time polymorphism therefore applies to template functions and classes since that is the only way the compiler can generate source code on your behalf. To achieve this, the runtime type for the template parameters must be fully-defined at compile time, even if those types have runtime polymorphic characteristics of their own. Runtime polymorphism applies to virtual methods and function pointers, both of which can be used to dynamically alter the execution path of your program. Virtual methods are made possible through virtual tables, which are essentially just arrays of function pointers. Each runtime type that derives from a base class with virtual methods provides its own virtual table, thus the runtime type determines which specific function overrides will be invoked at runtime, even if the runtime type cannot be determined at compile time. In this way you can generalise your code to work with the base type but still get the expected polymorphic behaviour whenever a derived type is passed instead.


How does virtual function support run time polymorphism?

Virtual functions are used to suport runtime polymorphism.In C++,if we have inheritance and we have overridden functions in the inherited classes,we can declare a base class pointer and make it to point to the objects of derived classes.When we give a keyword virtual to the base class functions,the compiler will no do static binding,so during runtime ,the base class pointer can be used to call the functions of the derived classes.Thus virtual functions support dynamic polymorphism.


Polymorphism in coelentrates?

polymorphism in coelentrates


What is a dynamic constructor?

dynamic constructor is a way to constructing an object based on the run type of some existing object. it basically uses standard virtual functions/polymorphism


Where to use polymorphism?

Polymorphism is used whenever you wish to achieve specific behaviour from a generic object, where the object's actual type may not be known or would be impossible to determine at compile time. By declaring virtual methods in the generic type (the base class), and overriding them in the derived type, you ensure that the derived object does "the right thing" regardless of its actual type, and regardless of whether the method is called directly or indirectly via the base class. With polymorphism, there is no need to determine the actual runtime type of the object, you get that for free simply by calling the appropriate virtual methods.


How does polymorphism promote extensibility?

how dose polymorphism promote extebsibility C++ virtual function is a member function of a class, whose functionality can be over-ridden in its derived classes. The whole function body can be replaced with a new set of implementation in the derived class.Through this u can be able to promote extensibility in your program by using Virtual function. Very simple concept. shahzad.dar@superior.edu.pk , shahzad.dar@gmail.com Lecturer in Superior University ,Lahore


How does java achieve run time polymorphism?

Polymorphism is Greek for "many forms". There are two types of polymorphism: static and dynamic. Static polymorphism occurs at compile time and is also known as compile time polymorphism. Dynamic polymorphism occurs at runtime and is also known as runtime polymorphism. Runtime polymorphism is a primary feature of the object-oriented programming paradigm. We achieve runtime polymorphic behaviour by defining virtual methods in a base class which derived classes can then override in order to provide more specialised implementations. Whenever we invoke one of these methods, the most-specialised override is executed automatically. In other words, polymorphic objects will behave according to their runtime type even when the runtime type cannot be determined at compile time.


What is polymorphism and its types?

Polymorphism means multiple form of a function, variable or object. In Computer Science, polymorphism is a programming language feature that allows values of different data types to be handles using a common interface. There are three types : Ad-Hoc Polymosphism, Parametric Polymorphism, Subtype/Inclusion Polymorphism. Source: Wikipedia.


What kind of drugs commonly has polymorphism?

Polymorphism is common with barbiturates, steroids, and sulphonamides.


Is polymorphism exist between prokaryotes?

Yes, polymorphism exists between the prokaryotes.