### Pointers and Polymorphism - both

Hello,
Look, this is kind of a dumb question to read and no i am not a dumb-ass. What exactly is the point of Pointers and Polymorphism? Please help i am stressing over this. Thank you sooooooo much in advance :)
Your question is really unspecific. So it is difficult to find an answer in short. May be you'll find it here and there http://www.cplusplus.com/doc/tutorial/polymorphism/ and there http://www.cplusplus.com/doc/tutorial/pointers/.
If you have a pointer (or reference) to some type T, that pointer can be use to point to an object of type T or an object of a type that is derived from T.
Polymorphism:
For example yo can have two functions:
`power(int base, int exp)` and `power(double base, double exp)`
Former would use simple multiplication in loop, while second will use more complex and slow approach.
Then when you write `power(a, b)` you do not specify which function to call. The best function for current case will be chosen depending on a and b types.
http://en.wikipedia.org/wiki/Polymorphism_%28computer_science%29
There are different kinds of polymorphism. The one that is usually meant and I think OP was asking about is called Subtype polymorphism in the link posted by MiiNiPaa. The MiiNiPaa explained the Parametric polymorphism but I don't think that has much to do with pointers.
closed account (D4S8vCM9)
Maybe the OP's "and" in the question wasn't the boolean "and" but just a conjugation and the OP want's to know about both: Polymorphism and Pointers, but each as own term??

So tcs answer was the best :-D
Topic archived. No new replies allowed.