Course List http://www.c-jump.com/bcc/

Blitz Introduction to C++ Objects


  1. A "Date" concept
  2. Programmatic control
  3. Switching to numeric representation
  4. Procedural approach
  5. Step in the right direction
  6. Problems with procedural approach
  7. Solution: use date as a variable
  8. Fundamental properties of built-in types
  9. C++ program fundamentals
  10. User-defined type
  11. class Date implementation
  12. Overloaded operator <<
  13. Conclusion

1. A "Date" concept



2. Programmatic control



3. Switching to numeric representation



4. Procedural approach



5. Step in the right direction



6. Problems with procedural approach



7. Solution: use date as a variable



8. Fundamental properties of built-in types


  • Size:
    
     char   ·
     
     short  ··
     
     int    ····
     
     double ········
     
  • Operations:
    int    ····
     
            +  addition
     
            -  subtraction
             
            *  multiplication
             
            /  division
             
            %  modulus
  • Size and behavior define what the type is.

  • Type determines operations.

  • Each arithmetic operation defined for integer is like anonymous, in-line function.


9. C++ program fundamentals


  • New concept:

    • bring together some functions and variables;

    • make such combination as a new C++ type.

  • 
    class Date {
        int serial_date; // variable
    public:
        // functions
        void set_date( int month, int day, int year );
        int get_month();
        int get_day();
        int get_year();
    };
    
    

10. User-defined type



11. class Date implementation



12. Overloaded operator <<



13. Conclusion