Contract -- interface

account

  class account {
  public:
  account();
  // assert( invariant() );
  
  virtual float balance() { return _balance; }
  
  void deposit(float x); 
\c{// to deposit money}
// require( x >= 0 ); // promise( balance() == old_balance + x && invariant() ); void withdraw(float x);
\c{// to withdraw money}
// require( x <= balance() ); // promise( balance() == old_balance - x && invariant() ); bool invariant() { return balance() >= 0; } protected: float _balance; };

slide: The $account$ contract