|
-
October 15th, 2011, 01:38 PM
#12
Re: difference between polymorphism and overloading
 Originally Posted by GCDEF
Func is overloaded. PolyFunc is, or can be, polymorphic. It's not really the same concept. Overloading gives a different signature to a function so you can call the function with diffferent argument types and numbers. In simplistic terms, polymorphism means that the function will be called for the correct class when accessed through a base class pointer.
It is the same overarching concept (see Lindley's post #2, my post #7 and nuzzle's post #10). We just normally use "polymorphism" in C++ to mean subtype polymorphism at runtime. That said, see Stroustrup's definition of polymorphism in his C++ glossary:
 Originally Posted by Bjarne Stroustrup
polymorphism - providing a single interface to entities of different types. virtual functions provide dynamic (run-time) polymorphism through an interface provided by a base class. Overloaded functions and templates provide static (compile-time) polymorphism.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|