what's difference b/t polymorphism andinheritance
rizwan anjum
0
Newbie Poster
Recommended Answers
Jump to PostIn OOP terminology, polymorphism is the ability for sub-classes to extend or even change the behavior they inherit from their parent classes. For example, if you have a class Animal, which has an
abstract
method namedspeak()
:public abstract class Animal { public abstract void …
Jump to Postwhat's difference b/t polymorphism andinheritance
Polymorphism is an optional feature of inheritance. Your question suggests that you think they're independent, which they're not. Without inheritance (or a significant amount of hackish workarounds), polymorphism doesn't occur.
That's assuming of course that we're talking about polymorphism through virtual member functions …
All 7 Replies
rizwan anjum
0
Newbie Poster
rizwan anjum
0
Newbie Poster
ddanbe
2,724
Professional Procrastinator
Featured Poster
Schol-R-LEA
1,446
Commie Mutant Traitor
Featured Poster
deceptikon
1,790
Code Sniper
Team Colleague
Featured Poster
PerplexedB
2
Newbie Poster
Loosipher
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.