Use initialiser list for constructor
Don't call virtual functions from constructors
Construction happens FIRST - variables don't exist yet!
Constructors can be chained - eg call another constructor from default
We should only see virtual variables in public
example of syntax: class rock: (is a) public IsAGameObject
Composition - model an object: door has handle, but door is not handle
Private inheritance implemented as you may have a base class you want to use
Virtual variables are determined at runtime - dynamic override can only be used on virtual variables
Diamond problem is objects inherit from a gameobject, but then another object inherits from both of those
Use virtual (pointer) to make sure object is not replicated
Using virtual may be more hardware intensive...
The most derived (original source?) class initialises
Using = delete can help to stop other classes inheriting or calling the object
Binding is designating memory addresses. Static is early, dynamic is late
No comments:
Post a Comment