Code Fragment: CreditCardH



#ifndef CREDIT_CARD_H                           // avoid repeated expansion
#define CREDIT_CARD_H

#include <string>				// provides string
#include <iostream>				// provides ostream

using std::string;				// make string accessible

class CreditCard {
private:                                	// private member data
  string    number;				// credit card number
  string    name;				// card owner's name
  int       limit;				// credit limit
  double    balance;				// credit card balance
public:
						// standard constructor
  CreditCard(string no, string nm, int lim, double bal=0);
						// accessors functions
  string   getNumber()    const   { return number; }
  string   getName()      const   { return name; }
  double   getBalance()   const   { return balance; }
  int      getLimit()     const   { return limit; }
						// update functions
  bool chargeIt(double price); 			// make a charge 

  void makePayment(double payment)		// make a payment
    { balance -= payment; }
};
  						// print card information
std::ostream& operator<<(std::ostream& out, const CreditCard& c);
#endif