please, someone please help me understand polymorphism.

I need help.

Thank you.
Pam

Recommended Answers

All 4 Replies

What your Problem ?

A polymorphic function:

class SomeClass {
public:

int doSomething(void);

int doSomeThing(int);

int doSomething(AClass&);
};

The member function doSomething(...) has three signatures in this instance, each with a different argument list. This is an example of polymorphic behavior where the type of thing (or things) you pass to the function determines which one gets the call. So, a class Animal may have a polymorphic function likes(). One may be likes(Cats), or likes(Dogs), or likes(Dinosaurs)... Clear as mud yet? :-)

edit

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.