Advertisement
Guest User

Untitled

a guest
Nov 21st, 2014
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. BankAccount::BankAccount(std::string name)
  2. : _name(std::move(name))
  3. , _balance()
  4. { }
  5.  
  6. LimitedBankAccount::LimitedBankAccount(double limit, std::string name)
  7. : BankAccount(std::move(name))
  8. , _limit(limit)
  9. ,a(NULL)
  10. { }
  11.  
  12. // call to my Constructors
  13. void LimitedBankAccount::NewLimitedBankAccount(double limit, std::string name)
  14. {
  15. this->a = new LimitedBankAccount(limit,name);
  16. }
  17.  
  18. #ifndef LIMITEDBANKACCOUNT_H
  19. #define LIMITEDBANKACCOUNT_H
  20.  
  21. #include <iostream>
  22. #include <string>
  23.  
  24. #include "BankAccount.h"
  25.  
  26. class LimitedBankAccount : public BankAccount{
  27.  
  28. public:
  29.  
  30. LimitedBankAccount(double limit, std::string _name);
  31. void setLimit(double num);
  32. double getLimit();
  33.  
  34. void NewLimitedBankAccount(double limit, std::string name);
  35. void print();
  36.  
  37. private:
  38.  
  39. double _limit;
  40. LimitedBankAccount* a;
  41.  
  42. };
  43.  
  44. #endif
  45.  
  46. void LimitedBankAccount::print()
  47. {
  48. if(a != NULL)
  49. {
  50. this->a->print();
  51. }
  52. std::cout << this->_limit << std::endl;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement