Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: ffoxin on Jul 19th, 2012  |  syntax: C++  |  size: 0.65 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4.  
  5.  
  6. using namespace std;
  7.  
  8.  
  9. // stored in bank
  10. class Account
  11. {
  12.         int             _pin;
  13.         int             _balance;
  14.  
  15.         bool CheckPin( );
  16. public:
  17.         Account( int pin, int balance );
  18.         ~Account( );
  19.  
  20.         int GetBalance( int pin ) const;
  21.         int ChangeBalance( int pin, int diff );
  22. };
  23.  
  24.  
  25. // for user only
  26. class Card
  27. {
  28.         int             _id;
  29.         int             _pin;
  30. public:
  31.         Card( int id );
  32.  
  33.         int Id( );
  34.         int Pin( );
  35. };
  36.  
  37.  
  38. class User
  39. {
  40.         string                  _name;
  41.         vector<Card>    _cards;
  42. public:
  43.         User( string name );
  44.        
  45.         void AddCard( const Card& card );
  46.  
  47.         int GetBalance( int card_number );
  48.         int ChangeBalance( int card_number, int diff );
  49. };