Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Coded by Simpl0S
- */
- #include <iostream>
- #include <list>
- // Include needed header files
- #include "Item.h"
- #include "Weapon.h"
- int main()
- {
- std::string strPistolName("Pistol"), strShotguntName("Shotgun"), strRifleName("Rifle");
- int nPistolValue{ 10 }, nPistolDamage{ 5 }, nShotgunValue{ 15 }, nShotgunDamage{ 10 },
- nRifleValue{ 20 }, nRifleDamage{ 5 };
- Weapon* pPistol = new Weapon(strPistolName, nPistolValue, nPistolDamage);
- Weapon* pShotgun = new Weapon(strShotguntName, nShotgunValue, nShotgunDamage);
- Weapon* pRifle = new Weapon(strRifleName, nRifleValue, nRifleDamage);
- std::list<Weapon*> weaponInventory;
- weaponInventory.push_back(pPistol);
- weaponInventory.push_back(pShotgun);
- weaponInventory.push_back(pRifle);
- std::list<Weapon*>::iterator weaponInventoryIT;
- for (weaponInventoryIT = weaponInventory.begin(); weaponInventoryIT != weaponInventory.end(); ++weaponInventoryIT)
- {
- (*weaponInventoryIT)->printAttributes();
- std::cout << std::endl;
- }
- /*
- Pistol.printAttributes();
- std::cout << std::endl;
- Shotgun.printAttributes();
- std::cout << std::endl;
- Rifle.printAttributes();
- std::cout << std::endl;
- */
- delete pPistol;
- delete pRifle;
- delete pShotgun;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement