View Single Post
Old 04-15-2013, 02:33 PM   #46
Reincarnate
x'); DROP TABLE FFR;--
Retired StaffFFR Veteran
 
Reincarnate's Avatar
 
Join Date: Nov 2010
Posts: 6,332
Default Re: Teach me CS stuff for interviews

I'm not sure what virtual/pure virtual really means so maybe that is impeding my understanding of this.

In my mind, the whole point of inheritance was to have some sort of logical structure of abstraction, where the parent (or whatever you call it, the class you inherit) class has methods/data attributes that a bunch of subclasses have in common. Like a Piece class in Chess or something where Rook, Queen, King etc all inherit from or something (just an example), as they all have their separate handling methods but they're all ultimately pieces that follow the same general rules.

So when we're talking about this polymorphism concept, I keep thinking "Why the heck is this even the case?" If I want to call a cat's make_sound, I would declare a cat and call make_sound. If I want to call some animal's make_sound, I would declare an animal object and call make_sound.

Unless this idea is to have a cat object that can "choose" somehow to all either its local make_sound or its parent class' make_sound? Am I anywhere close on any of this? What's the point of this polymorphism concept?
Reincarnate is offline   Reply With Quote