Object oriented programming is a sound and bold approach to c++ and
internet wiring application and video games. It reduces a lot of code
messes, made by global and half global functions. One of the more
advanced object programming techniques are private access, poly
morph and object message inheritance. It is set by c++ bjarne
stroustrup and iso isometric standard convention comitee to use
classes instead of structs and structures for making objects. Which
means you most definitely should, but not must or have to.
class Monster
{
std::string memory_attributes{};
public:
void treck();
void track();
void trace();
};
The treck() function makes the monster roam and do human like jogging
and trimming. track() means the monster goes ai path tracking and
trace() means it tries to find other monsters in the area.
class Weapon
{
std::string memory_attributes{};
public:
void use();
};
void Weapon::use()
{
for(;;)
{
weapon_shift(memory_attributes);
if (memory_attrributes == "clear")
{
break;
}
}
}
The use of weapons on monsters:
void fight(Monster&, Weapon&);
It is also possible to make new sorted game modes with polymorphism
to apply weapons and monsters to alternative mechanisms of either or
both. Inheritance an be used for making an inventory and memory
utilities.
Comments
Post a Comment