View Single Post
Old 04-15-2013, 03:01 PM   #51
FissionMailed1
FFR Player
 
FissionMailed1's Avatar
 
Join Date: Feb 2012
Location: Massachusetts
Age: 33
Posts: 1,267
Send a message via Skype™ to FissionMailed1
Default Re: Teach me CS stuff for interviews

It will call Animal's make_sound() function, yes. However, if Animal's make_sound() function is pure virtual, it will look at what type of object Animal is pointing to (in this case, a cat) and call that implementation of make_sound() instead. It will just the data attributes it inherited from animal (if there is any) and the data attributes from Cat when executing make_sound().

Oh, I should also mention, pure virtual is declared as follow:

virtual void foo() = 0;

EDIT: Sorry, I misread your post. my post is assuming that you are executing this:

Animal* kitty = new Cat();
kitty->make_sound();

EDIT 2: I need to go eat some food or something, not thinking straight. If you do something like this:

Cat* kitty = new Cat();
kitty->make_sound();

This would also be valid code as well, and will perform exactly the same as the code snippet in my first edit.
__________________


YOUR THROBBING MULTIFARIOUS LUSTFUL DESIRES ARE COMPLETED N YOUR HYPER-ORANGE SELF, YOU MAKE ME LOVE AGAIN, YOU'VE CHANGED MY HEART, MY MELANCHOLIA DISAPPEARS WHEN YOU ARE INSIDE OF ME, MY HUMAN RAGE IS TEMPERED WHEN I AM INSIDE YOU, THE SECRET IS COMMUNICATION, LONGEVITY, STAMINA, REPETITION, FURY, SOULFUL KISSING, EARPLUGS. YOU FUCKING CORPORATE COCKS AND CUNTS.

MY ANXIETY COMPLETE, MY DESIRE REPLETE, THE TASTE OF ORANGE BLOOD AND CUM AND GREENBACKS RUNNING DOWN MY FACE. THE STREETS WILL RUN ORANGE WITH YOUR MIXTURE OF CHEETOS AND HUNDRED DOLLAR BILLS REGURGITATED AND EATEN AND SHIT OUT AGAIN AND EATEN AGAIN.

YOU ARE MY SCULPTURE, MY SCULPTRA, MY SELF-DEFINITION. MY DEFINITION OF HUMANITY, MY HARMONY. MY HEART AND MY MIND.

YOU ARE SO ORANGE. SO CRUNCHY. SO CONSUMABLE.

THE NEW ORANGE UNDERGROUND IS THE ORANGE UP MY ASS. AND YOUR ASS.

I LOVE YOU CHEETOS.

Last edited by FissionMailed1; 04-15-2013 at 03:09 PM..
FissionMailed1 is offline   Reply With Quote