Not until next summer holiday or maybe never, we'll see. ; -)
lazy ass excuse of a coder. Kef to you old timer. Kef to you!
Not until next summer holiday or maybe never, we'll see. ; -)
class Orc
{
public:
int hp, maxHp;
int mana, maxMana;
void fight()
{
cout << "Fighting!\n";
}
void run()
{
cout << "Running!\n";
}
void growl()
{
cout << "Growl\n";
}
};
class Elf
{
int hp, maxHp;
int mana, maxMana;
void fight()
{
cout << "Fighting!\n";
}
void run()
{
cout << "Running!\n";
}
void speakElven()
{
cout << "El grath\n";
}
};
class Monster
{
public:
int hp, maxHp;
int mana, maxMana;
void fight()
{
cout << "Fighting!\n";
}
void run()
{
cout << "Running!\n";
}
};
class Orc : public Monster
{
public:
void growl()
{
cout << "Growl\n";
}
};
class Elf : public Monster
{
public:
void speakElven()
{
cout << "El grath\n";
}
};
Elf legolas;
legolas.hp = 200;
legolas.fight();
class Monster
{
public:
int hp, maxHp;
int mana, maxMana;
// by specifying virtual, it allows the fight function to be overriden in subclasses
virtual void fight()
{
cout << "Fighting!\n";
}
void run()
{
cout << "Running!\n";
}
}
class Orc : public Monster
{
public:
void growl()
{
cout << "Growl!\n";
}
}
class Elf : public Monster
{
public:
// overriden fight function from monster parent class
void fight()
{
// do eleven fight
}
void speakElven()
{
cout << "El Grath!\n";
}
}
class Monster
{
int hp,maxHp;
int mana, maxMana;
virtual void speak() = 0;
virtual void fight()
{
cout << "fighting!\n";
}
void run()
{
cout << "Running\n";
}
}
Monster m; // Error: cannot create an instance of an abstract class
m.run();
Monster *m = new Elf();
m.speak();
class Orc : public Monster
{
public:
void growl()
{
cout << "Growl!\n";
}
void speak()
{
growl();
}
}
class Elf : public Monster
{
public:
// overriden fight function from monster parent class
void fight()
{
// do eleven fight
}
void speakElven()
{
cout << "El Grath!\n";
}
void speak()
{
speakElven();
}
}
vector<Monster*> monstersOnMap;
for (int i =0; i < monstersOnMap.size(); i++)
{
monstersOnMap[i]->speak(); // since I know that a monster has a speak function I can call it.. doens't matter if its an elf or an orc or whatever
}
class Button
{
Image buttonPicture; // picture is 50 kb
std::string text;
public:
void pressed();
void setText(std::string text)();
};
Form::Form() // the initlizer of a form class (Something that would have buttons)
{
Button b1();
Button b2();
Button b3();
Button b4();
add(b1);
add(b2);
add(b3);
add(b4);
}
class Button
{
static Image buttonPicture; // picture is 50 kb
std::string text;
public:
void pressed();
void setText(std::string text)();
};
class Monster{
public:
static int hp;
};
Monster m;
m.hp = 100;
Monster m2;
m2.hp =200;
cout << m.hp << endl; // prints out 200 since hp is static
class ABC
{
static int x;
int y;
static void random()
{
cout << x << endl;
cout << y; // Error because y is not static
}
}
ABC::random();
// an instance of the class may also call them
ABC a;
a.random();
#include<stdio.h>
#define p printf
main()
{
p("Hello World!\n");
getch();
}
Try sololearn.com and use what is here with all that is here it is enough to change source code of tibia easilyHello, will @Fallen or @OmfgRegister will continue this thread? i'm willing to learn