Guest User

Untitled

a guest
Nov 23rd, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. #include <Character.h>
  2.  
  3. Character* Character::uniqueInstance = NULL;
  4.  
  5. Character* Character::Instance(){
  6. if(Character::uniqueInstance == NULL){
  7. uniqueInstance = new Character();
  8. }
  9. return uniqueInstance;
  10. }
  11.  
  12. Character::Character(){
  13. stats = new Attributes();
  14. }
  15.  
  16. Character::~Character(){
  17. delete Character::uniqueInstance;
  18. Character::uniqueInstance = NULL;
  19. }
  20.  
  21. void Character::showAttributes(){
  22. cout<<"Name: "<<stats->name<<endl;
  23. cout<<"Gender: Man"<<endl;
  24. cout<<"Strength: "<<stats->Strength<<endl;
  25. cout<<"Dexterity: "<<stats->Dexterity<<endl;
  26. cout<<"Intelligence: "<<stats->Intelligence<<endl;
  27. cout<<"Wisdom: "<<stats->Wisdom<<endl;
  28. }
  29.  
  30. void Character::rename(string name){
  31. stats->name=name;
  32. }
Add Comment
Please, Sign In to add comment