previous | start | next

## Interface

- To define a class, we first need to specify an interface.
- The interface consists of all member functions we want to apply to objects of that type.
- The interface is specified in the class definition.
- Example: Product class member functions:
  - Make a new product.
  - Read in a product object.
  - Compare two products and find out which one is better.
  - Print a product.
- Product class header:

  >     class Product
  >     {
  >     public:
  >        Product();
  >        void read();
  >        bool is_better_than(Product b) const;
  >        void print() const;
  >     private:
  >        implementation details
  >     };

previous | start | next