home *** CD-ROM | disk | FTP | other *** search
/ C++ for Dummies (3rd Edition) / C_FD.iso / CHAP19 / CHAP19_1.CPP next >
C/C++ Source or Header  |  1996-09-15  |  421b  |  27 lines

  1. // Chap19_1.cpp
  2. class Account
  3. {
  4.   public:
  5.    //declare withdrawal pure virtual
  6.    virtual void withdrawal(float amnt) = 0;
  7. };
  8. class Savings : public Account
  9. {
  10.   public:
  11.    virtual void withdrawal(float amnt)
  12.    {
  13.    }
  14. };
  15.  
  16. void fn(Account *pAcc)
  17. {
  18.    //withdraw some money
  19.    pAcc->withdrawal(100.00F);  //now it works
  20. };
  21. int main( )
  22. {
  23.    Savings s;   //open an account
  24.    fn(&s);
  25.    return 0;
  26. }
  27.