For the code snippet given below, how do I start an example of class anime with variables (like X, Y, Type)? I am working it correctly, it triggers instances, even though how many of them join ... I have to know the best way to make an enemy with only a few variables which will be different for each of my examples. Especially when some are in the base class of those variables and others are not. Include logic in enemy manufacturer and base constructors. You can use the member to initialize the variable. Class BaseObject {Public: Virtual Zero Render () = 0; Int x; Int y; }; Square Enemies: Public Base Object {Public: Enemy () {} Virtual Zoom Render () {cout & lt; & Lt; "Submit Enemy" & lt; & Lt; Endl; Type Type std :: set & lt; BaseObject * & gt; GAMEOBJECTS; GAMEOBJECTS g_gameObjects; Int main () {g_gameObjects.insert (new enemy ()); G_lootObjects.insert (new booty); (For GAMEOBJECTS :: iterator = g_gameObjects.begin (); it! = G_gameObjects.end (); This ++) {(* it - -) Render (); } (GAMEOBJECTS :: Iterator = g_lootObjects.begin (); it! = G_lootObjects.end (); this ++) {(* it) -> Render (); } Return 0; }
Comments
Post a Comment