C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Static Ploymorphism

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
hack_tick
Guest





PostPosted: Fri Feb 24, 2006 2:06 am    Post subject: Static Ploymorphism Reply with quote



Hi Guys!
Is function overloading a kind of static polymorphism?
Back to top
Jaspreet
Guest





PostPosted: Fri Feb 24, 2006 2:06 am    Post subject: Re: Static Ploymorphism Reply with quote



hack_tick wrote:
Quote:
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.
Back to top
Alf P. Steinbach
Guest





PostPosted: Fri Feb 24, 2006 10:06 am    Post subject: Re: Static Ploymorphism Reply with quote



* Jaspreet:
Quote:
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?
Back to top
Axter
Guest





PostPosted: Fri Feb 24, 2006 12:06 pm    Post subject: Re: Static Ploymorphism Reply with quote

hack_tick wrote:
Quote:
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/Polymorphism_(computer_science)
Back to top
Guest






PostPosted: Sat Feb 25, 2006 7:06 am    Post subject: Re: Static Ploymorphism Reply with quote

This might Help you
http://doc.trolltech.com/qq/qq13-apis.html#staticpolymorphism
Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.