Friday, 9 October 2015

Session 3

Ship
+turn ()
+move()
+shoot()

-rotation:float
-momentum:float
-thrust:float

(example of UML diagram)

Looked for common functionality
Looked at how the objects inherit
All gameobjects have potential for animation
Polymorphism - one version of attack (boss for example) can be different if virtual is used. Attack would also be used by a regular monster if boss is also a monster
Do not override non-virtual stuff!

#ifndef (headername)
#define (headername)
#endif
or use
#pragma once

these make sure headers and such are only included once during compilation

Forward declaration tells the compiler the identifier's size and data type; this is all the compiler needs to run
Forward declaration is a performance saver (less hardware intensive)

Static memory - memory is allocated but once it drops off it deallocates.
Cleanup is automatic and this prevents memory leak
Static things need to know their quantity though...
Memory gets popped off the stack after its space, first in last out
Dynamic memory allocation is separate from spaces so it is up to you (me!) to point to it and deallocate... otherwise problems

No comments:

Post a Comment