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

Well, if you have a "piece", but you want to call move() on that piece, how exactly does that piece move? You wouldn't know how to "move" unless you implemented a specific way to move depending on which type of piece it is (the subclass).

Your last questions are correct. You can choose which make_sound() is called.

Another example of polymorphism, using a function:

Piece* some_piece = new Rook()

move(some_piece*);

void move (piece* piece_to_move) {
// do some stuff to move in a generic way, disregarding which type of piece it is
}

This is all assuming that move() is either virtual or pure virtual.
__________________


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 02:46 PM..
FissionMailed1 is offline   Reply With Quote