Jump to content

Polymorphism...


Recommended Posts

Is there any easy way to grasp the concept and usage of polymorphism? I understand that it's uber powerful and all (and uber evil), but there are very few guides on it, and the ones that are there tend to be confusing.

 

 

So, does anyone know any tutorials or anything that introduce polymorphism and actually explain it and all? Or, can someone describe it in a nutshell?

 

 

 

This stuff is more evil than WinSocks...

 

 

EDIT: So, no-one wants to help? Oh markie, where art thou?

Share this post


Link to post
Share on other sites

Is there any easy way to grasp the concept and usage of polymorphism? I understand that it's uber powerful and all (and uber evil), but there are very few guides on it, and the ones that are there tend to be confusing.

So, does anyone know any tutorials or anything that introduce polymorphism and actually explain it and all? Or, can someone describe it in a nutshell?

This stuff is more evil than WinSocks...

EDIT: So, no-one wants to help? Oh markie, where art thou?

510193[/snapback]

 

Sleeping :) 'twas a great sleep too. Actually managed to fall asleep before 1AM I think!

 

I expect you're wanting polymorphism in C++? I learnt about it in......... Java :) It is a difficult thing to explain...

 

I'll uhm... work up some code(?), find tutorials and stuff for you later on. In the mean time you could practice pointers, because you'll be needing them :P Maybe play with structures too?

Share this post


Link to post
Share on other sites

aww man....polymorphism.....i remember learning that.....and promptly forgetting about it.

 

if i can find my old computing book, i'll reply with an explanation :blink:

 

man...you do pick 'em KB....

Share this post


Link to post
Share on other sites

You mean a simple int* pPointerToPointer = &pOtherPointer won't work?

510533[/snapback]

 

close..

 

int i = 123;
int *p = &i;
int **pp = &p;

printf("pp at memory address %x\n", &pp);
printf("pp points to %x\n", pp);
printf("pp pointer points to %x\n", *pp);
printf("pp value %d\n", *(*pp));
printf("\n");
printf("p at memory address %x\n", &p);
printf("p points to %x\n", p);
printf("p value %d\n", *p);

 

pp at memory address 22ff34

pp points to 22ff38

pp pointer points to 22ff44

pp value 123

 

p at memory address 22ff38

p points to 22ff44

p value 123

Press any key to continue . . .

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...