Hello all. I'm totally new here. In fact I'm rather new to C++. (I used to dwell in the realm of VB) After working on "Phantasm Souls" for a year or so (I'm not sure if anyone here has heard of it) I decided to move over to C++.
I have a fairly strong understanding of it, thanks to Game Coding Complete 2nd Edition and Learning C++ (by Neill Graham) and a few internet resources.
My only question I've been unable to find an answer for, and it's probably really simple, is why Mr Mike creates abstract base classes for all the major parts of his project, even if only one other class will inherit from it. Can't the inheriting class just BE the top of the heirarchical tree?
Is this for the sake of efficiency, the sake of quickly modifiable code or is it just a known C++ coding practice?
A good example is the iAudio and iAudioBuffer that are inherited by cAudio and cAudioBuffer who only perform the generic parts of the audio code before being inherited by cDirectSoundAudio and cDirectSoundAudioBuffer who do the sound API specific parts. To my mind cAudio and cAudioBuffer could do it all without the need for the "interface" Abstract Base Classes.
I hope I've explained what I'm confused about clearly
Steve
I have a fairly strong understanding of it, thanks to Game Coding Complete 2nd Edition and Learning C++ (by Neill Graham) and a few internet resources.
My only question I've been unable to find an answer for, and it's probably really simple, is why Mr Mike creates abstract base classes for all the major parts of his project, even if only one other class will inherit from it. Can't the inheriting class just BE the top of the heirarchical tree?
Is this for the sake of efficiency, the sake of quickly modifiable code or is it just a known C++ coding practice?
A good example is the iAudio and iAudioBuffer that are inherited by cAudio and cAudioBuffer who only perform the generic parts of the audio code before being inherited by cDirectSoundAudio and cDirectSoundAudioBuffer who do the sound API specific parts. To my mind cAudio and cAudioBuffer could do it all without the need for the "interface" Abstract Base Classes.
I hope I've explained what I'm confused about clearly
Steve