Book Image

Learning C++ by creating games with UE4

By : William Sherif
Book Image

Learning C++ by creating games with UE4

By: William Sherif

Overview of this book

Table of Contents (19 chapters)
Learning C++ by Creating Games with UE4
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
2
Variables and Memory
Index

Multiple inheritance


Not everything multiple is as good as it sounds. Multiple inheritance is when a derived class inherits from more than one base class. Usually, this works without a hitch if the multiple base classes we are inheriting from are completely unrelated.

For example, we can have a class Window that inherits from the SoundManager and GraphicsManager base classes. If SoundManager provides a member function playSound() and GraphicsManager provides a member function drawSprite(), then the Window class will be able to use those additional capabilities without a hitch.

Game Window inheriting from Sound Man and Graphics Man means Game Window will have both sets of capabilities

However, multiple inheritance can have negative consequences. Say we want to create a class Mule that derives from both the Donkey and Horse classes. The Donkey and Horse classes, however, both inherit from the base class Mammal. We instantly have an issue! If we were to call mule.talk(), but mule does not override...