C++ Programming - OOPS Concepts - Discussion

Discussion :: OOPS Concepts - General Questions (Q.No.18)

18. 

Which of the following correctly describes overloading of functions?

[A]. Virtual polymorphism
[B]. Transient polymorphism
[C]. Ad-hoc polymorphism
[D]. Pseudo polymorphism

Answer: Option C

Explanation:

No answer description available for this question.

Vicky said: (May 13, 2012)  
What is meant by Ad-hoc polymorphism, transient and psuedo polymorphism?

Varsha said: (May 18, 2012)  
What is meant by Ad-hoc polymorphism, transient and psuedo polymorphism.

Aniket said: (May 20, 2012)  
Ad-hoc polymorphism allows functions with the same name act differently for each type. For example, given two ints and the + operator, it adds them together. Given two std::strings it concatenates them together. This is called overloading.

Here is a concrete example that implements function add for ints and strings,

#include <iostream>
#include <string>

int add(int a, int b) {
return a + b;
}

std::string add(const char *a, const char *b) {
std::string result(a);
result += b;
return result;
}

int main() {
std::cout << add(5, 9) << std::endl;
std::cout << add("hello ", "world") << std::endl;
}
Ad-hoc polymorphism also appears in C++ if you specialize templates. Returning to the previous example about max function, here is how you'd write a max for two char *,

template <>
const char *max(const char *a, const char *b) {
return strcmp(a, b) > 0 ? a : b;
}

Sanil said: (Jul 19, 2012)  
Can anyone explain more about Ad-hoc polymorphism, transient and psuedo polymorphism ?

Rupali said: (Jul 26, 2012)  
What is mean by transient and pseudo polymorphism ?

Kalpana said: (Aug 7, 2012)  
What is transient and pseudo polymorphism ? and it is a type polymorphism ? then explain more about Ad-hoc polymorphism ?

Shweta said: (Aug 13, 2012)  
In programming languages, ad-hoc polymorphism is a kind of polymorphism in which polymorphic functions can be applied to arguments of different types, because a polymorphic function can denote a number of distinct and potentially heterogeneous implementations depending on the type of argument(s) to which it is applied. It is also known as function overloading or operator overloading.

Pavithra said: (Jan 1, 2013)  
Ad-hoc polymorphism behaves differently for different data types with same name.

Can anyone explain about pseudo polymorphism and transient polymorphism?

Supreet Kaur said: (Jan 3, 2013)  
Is Ad-hoc polymorphism and overloading is the same thing?

Shivajiswaraj said: (Mar 18, 2013)  
Ad hoc polymorphism allows to funtion overloading.

Ramesh said: (Jun 13, 2013)  
What is meant by Ad-hoc polymorphism, transient and pseudo polymorphism?

Sudhanshu said: (Jul 8, 2013)  
The Four Polymorphisms in C++.

When people talk about polymorphism in C++ they usually mean the thing of using a derived class through the base class pointer or reference, which is called subtype polymorphism. But they often forget that there are all kinds of other polymorphisms in C++, such as parametric polymorphism, ad-hoc polymorphism and coercion polymorphism.

These polymorphisms also go by different names in C++,

Subtype polymorphism is also known as runtime polymorphism.

Parametric polymorphism is also known as compile-time polymorphism.

Ad-hoc polymorphism is also known as overloading.

Coercion is also known as (implicit or explicit) casting.

Ad-hoc polymorphism allows functions with the same name act differently for each type. For example, given two 'int' values and the '+' operator, it adds them together. Given two 'std::strings' it concatenates them together. This is called overloading.

Ram said: (Aug 13, 2013)  
What is meant by Pseudo polymorphism?

Pratishruti said: (Sep 18, 2013)  
What is pseudo polymorphism or is there any other name to this?

Banu said: (Oct 24, 2013)  
Can anyone give example pseudo polymorphism?

Swati said: (Feb 27, 2014)  
I want to know about Pseudo polymorphism and Transient polymorphism?

Gopal said: (Mar 6, 2014)  
Ad-hoc means compiled time polymorphism in which two things operator and function overloading means same name different argument at time or different work.

Snehal said: (May 24, 2014)  
What is the exact means of ad-hoc polymorphism?

Ankita said: (Jul 14, 2014)  
Ad hoc polymorphism is also known as operator overloading.

Ad hoc polymorphism is a specific case of polymorphism, where different operators have different implementations depending on their arguments.

Saksham said: (Aug 27, 2014)  
I am unable to find any material related to pseudo polymorphism(no definition, nothing at all). Any help would be greatly appreciated.

Vishal said: (Sep 16, 2014)  
As polymorphism has of 2 types, then ad-hoc polymorphism, pseudo polymorphism, Transient polymorphism work at compile time or run time ?

Govindarajan said: (May 16, 2015)  
Pseudo Polymorphism is function overriding in derived class.

Chaitali said: (Jul 9, 2015)  
What is Ab-hoc polymorphism concept?

Jasmine said: (Dec 21, 2015)  
Ab-hoc polymorphism is also a operator overloading or not?

Rubini said: (Feb 17, 2016)  
Coercion polymorphism happens when an object or a primitive is cast into another object type or primitive type.

Lovish said: (Mar 30, 2016)  
These polymorphisms also go by different names in C++,

- Subtype polymorphism is also known as runtime polymorphism.

- Parametric polymorphism is also known as compile-time polymorphism.

- Ad-hoc polymorphism is also known as overloading.

- Coercion is also known as (implicit or explicit) casting.

Vitthal said: (Apr 4, 2016)  
Can we add operator and function overloading together?

Sri said: (May 3, 2016)  
What is a pseudo-polymorphism and transient polymorphism?

Please, explain it.

Soujanya said: (Jul 26, 2016)  
What is meant by function overloading? Why it is known as function polymorphism in OOPs?

Gelu Menumorut said: (Aug 11, 2016)  
It seems like pseudo and transient polymorphisms are only made-up word associations that sound like something real, but they are not? Could they be also: dual or multi polymorphism, virtual polymorphism (nobody asks about it, hmmm), constant or mutable polymorphism, friendly polymorphism, volatile polymorphism, atomic polymorphism, mutual polymorphism, you can name it in too many combinations.

Sanjay Nannaware said: (Sep 9, 2016)  
The Four Polymorphisms in C++.

When people talk about polymorphism in C++ they usually mean the thing of using a derived class through the base class pointer or reference, which is called subtype polymorphism. But they often forget that there are all kinds of other polymorphisms in C++, such as parametric polymorphism, ad-hoc polymorphism and coercion polymorphism.

These polymorphisms also go by different names in C++,

Subtype polymorphism is also known as runtime polymorphism.

Parametric polymorphism is also known as compile-time polymorphism.

Ad-hoc polymorphism is also known as overloading.

Coercion is also known as (implicit or explicit) casting.

Ad-hoc polymorphism allows functions with the same name act differently for each type. For example, given two 'int' values and the '+' operator, it adds them together. Given two 'std::strings' it concatenates them together. This is called overloading.

Bugslife said: (Nov 22, 2016)  
Then how it would be ad-hoc? If ad-hoc for operator overloading virtual used for overloading of functions.

Yamini said: (Sep 23, 2017)  
Can anyone please tell about overloading function in detail?

R.Kani Mozhi said: (Jan 22, 2018)  
Briefly explain the ad-hoc polymorphism.

Sam said: (Aug 28, 2021)  
Subtype polymorphism is also known as runtime polymorphism.

Parametric polymorphism is also known as compile-time polymorphism.

Ad-hoc polymorphism is also known as overloading.

Coercion is also known as (implicit or explicit) casting.

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.