C++ Programming - OOPS Concepts - Discussion
Discussion Forum : OOPS Concepts - General Questions (Q.No. 36)
36.
Which of the following is a mechanism of static polymorphism?
Discussion:
17 comments Page 1 of 2.
Paras Santoki said:
1 decade ago
How Template achieve the static polymorphism can any explain?
Ashish said:
1 decade ago
I also have same doubt because template is a mechanism which is achieve through dynamic polymorphism.
Nilay Vishwakarma said:
1 decade ago
This is static(compile time) polymorphism., same code for any type.
template<class XYZ>
XYZ large(XYZ a, XYZ b)
{
if(a>b)return a;
else return b;
return a;
}
int main()
{
string str1("Nilay"),str2("IndiaBIX")
cout<<large(10,20)<<"\n";
cout<<max(str1,str2);
return 0;
}
template<class XYZ>
XYZ large(XYZ a, XYZ b)
{
if(a>b)return a;
else return b;
return a;
}
int main()
{
string str1("Nilay"),str2("IndiaBIX")
cout<<large(10,20)<<"\n";
cout<<max(str1,str2);
return 0;
}
Payal said:
1 decade ago
How can template mechanism of static polymorphism? please explain in brief.
Akash said:
1 decade ago
Why Template?
Priya said:
1 decade ago
What is meant by static polymorphism?
Qwe said:
1 decade ago
What is static polymorphism?
Radhika said:
1 decade ago
Explain it in brief?
Bharat said:
10 years ago
What are templates?
Mohammed said:
9 years ago
What is dynamic polymorphism?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers