473,396 Members | 2,009 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Static Ploymorphism

Hi Guys!
Is function overloading a kind of static polymorphism?

Feb 24 '06 #1
4 1957

hack_tick wrote:
Hi Guys!
Is function overloading a kind of static polymorphism?


I may be wrong but I suppose function templates is a case of static
polymorphism. Function over-loading is not considered a correct example
of static polymorphism. It (overloading) is sometimes termed as ad-hoc
polymorphism. Let the experts throw more light on it.

Feb 24 '06 #2
* Jaspreet:
hack_tick wrote:
Hi Guys!
Is function overloading a kind of static polymorphism?


I may be wrong but I suppose function templates is a case of static
polymorphism. Function over-loading is not considered a correct example
of static polymorphism. It (overloading) is sometimes termed as ad-hoc
polymorphism. Let the experts throw more light on it.


It all depends on what one means by "polymorphism", which depends on
context.

In the most general meaning, yes, although function overloading is not
enough by itself. It requires some templated client code in order to
deal with different types in the same source code way. But templated
code could not do different things in the same way with different types
if there was no function or operator overloading (or other mechanism).

In the most common very narrow meaning we do not even consider static
polymorphism, e.g. the standard's "polymorphic class" (def: §10.3/1).

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Feb 24 '06 #3
hack_tick wrote:
Hi Guys!
Is function overloading a kind of static polymorphism?


Yes, it is static polymorphism.
C++ has one type of dynamic polymorphism, and two types of static
polymorphism.
1. Ad-hoc polymorphism (Function Overloading) [static binding]
2. Parametric polymorphism (Templates) [static binding]
3. Virtual methods (run-time) [dynamic binding]

Static polymorphism is resolved at compile time, which is unlike
dynamic polymorphism, which is resolved at runtime.
See following link:
http://en.wikipedia.org/wiki/Polymor...mputer_science)

Feb 24 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Scott J. McCaughrin | last post by:
The following program compiles fine but elicits this message from the linker: "undefined reference to VarArray::funct" and thus fails. It seems to behave as if the static data-member:...
15
by: Samee Zahur | last post by:
Question: How do friend functions and static member functions differ in terms of functionality? I mean, neither necessarily needs an object of the class to be created before they are called and...
5
by: Mountain Bikn' Guy | last post by:
How would I do this? public sealed class UtilityClass { public static MyObject Object1;//see note below about importance of static object names in this class public static MyObject Object2;...
3
by: Mauzi | last post by:
hi, this may sound odd and noob like, but what is the 'big' difference between static and non-static funcitons ? is there any performace differnce? what is the best way to use them ? thnx ...
3
by: Jay | last post by:
Why are there static methods in C#. In C++ static was applied to data only (I believe) and it meant that the static piece of data was not a part of the object but only a part of the class (one...
3
by: Kirk Marple | last post by:
Just want to see if this is 'by design' or a bug... I have a common List<T> defined in a base class, and the base class has a static property to expose this list. I wanted the derived class to...
9
by: Laban | last post by:
Hi, I find myself using static methods more than I probably should, so I am looking for some advice on a better approach. For example, I am writing an app that involves quite a bit of database...
55
by: Zytan | last post by:
I see that static is more restricted in C# than in C++. It appears usable only on classes and methods, and data members, but cannot be created within a method itself. Surely this is possible in...
14
by: Jess | last post by:
Hello, I learned that there are five kinds of static objects, namely 1. global objects 2. object defined in namespace scope 3. object declared static instead classes 4. objects declared...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.