Beginner C++ Game Programming Tutorial 12
Here we learn about the concept of encapsulation (ask your mom where she keeps the Vicodin!), which is the main principle behind object oriented programming (so listen the fuck up eh?). We also learn how to construct shit, and how to make our shit private.
Visual Studio has a <cool feature> wherein when you use "quick actions... -> move definition location" on a constructor, it adds a goddamn
inline keyword which fucks the whole goddamn works up! D:< This is fixed in the homework solution, but if you are attempting the homework before peeking (as you should be), then this could fuck you up royally. Keep it in mind.
- Encapsulation and data hiding
- How to create a constructor
- How do initialize embedded objects (class initializer list)
- How to control member access (
This page has some interesting discussion on why we bother with all this encapsulation bullshit.
Video Timestamp Index
- Intro 0:00
- Encapsulation: Difference between
privatedata members 0:55
- Poo class: Making member data private 2:43
- Important note on "Getters" and "Setters" 5:00
- Advantages of
privatemember data with a getter and setter, as opposed to just
publicmember data 7:07
- Constructors: setting values during object initialization 9:30
- Class initializer list: Initializing embedded objects (Poo objects inside a Game object) 12:34
- Class initializer list order must correspond to the order of data member declaraion 17:10
- Visual Studio tricks: Quick actions -> Move definition location, but with a little brainfucky surprize you will learn about very soon 19:59
- Reasons to properly encapsulate class member data 20:52
- Homework 30:10
- Encapsulate the fuck out of the
- Increase the number of
Pooobjects from 3 to 9.
The solution is given in this video.
The starting code for Tutorial 12 is here.