1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
|
#include <iostream>
using namespace std;
class aWeapon
{
public:
aWeapon(int id, int tier, int speed, string name);
~aWeapon();
int get_aID();
int get_aTier();
int get_aSpeed();
string get_aName();
private:
int aID;
int aTier;
int aSpeed;
string aName;
};
aWeapon :: aWeapon(int id, int tier, int speed, string name)
{
int aID = id;
int aTier = tier;
int aSpeed = speed;
string aName = name;
}
aWeapon :: ~aWeapon() {}
int aWeapon :: get_aID()
{
return aID;
}
int aWeapon :: get_aTier()
{
return aTier;
}
int aWeapon :: get_aSpeed()
{
return aSpeed;
}
string aWeapon :: get_aName()
{
return aName;
}
// Main
int main()
{
// Loot List
// #, T, S, Name
aWeapon Dagger1 (1, 1, 4, "Dagger");
aWeapon Dagger2 (2, 1, 4, "Dagger");
aWeapon Staff1 (3, 1, 3, "Staff");
aWeapon Staff2 (4, 1, 3, "Staff");
aWeapon Sword1 (5, 1, 4, "Sword");
aWeapon Sword2 (6, 1, 4, "Sword");
aWeapon Hatchet1 (7, 1, 3, "Hatchet");
aWeapon Hatchet2 (8, 1, 3, "Hatchet");
aWeapon Hammer1 (9, 1, 2, "Hammer");
aWeapon Hammer2 (10, 1, 2, "Hammer");
aWeapon FishingRod1 (11, 1, 5, "Fishing Rod");
aWeapon FishingRod2 (12, 1, 5, "Fishing Rod");
aWeapon Wand1 (13, 1, 5, "Wand");
aWeapon Wand2 (14, 1, 5, "Wand");
aWeapon LongSword1 (15, 1, 3, "Longsword");
aWeapon LongSword2 (16, 1, 3, "Longsword");
aWeapon OldBook1 (17, 1, 2, "Old Book");
aWeapon OldBook2 (18, 1, 2, "Old Book");
// NOTE: Later, Weapon1 and Weapon2 will have different stats.
cout << "Weapon: " << LongSword2.get_aName() << ".\n";
cout << "#: " << LongSword2.get_aID() << "\t";
cout << "Tier: " << LongSword2.get_aTier() << "\t";
cout << "Speed: " << LongSword2.get_aSpeed() << "\n\n";
cout << "END OF TEST\n\n";
return 0;
}
|