CPSC - Object Oriented Programming

  1. How are objects defined?
    • By their attributes
    • By operations than can be performed on them
  2. Object
    • A real/physical or imaginary thing
    • E.g Person, Bank Account, Address etc
  3. Class
    • Set of objects with the same properties
    • Forms the blueprint of an object
  4. Client
    Creates class objects and manipulates them with public operations
  5. Accessor
    Can only view values of data members
  6. Modifier
    Can view and/or change data members
  7. Constructor
    Used to build and initialize an object
  8. Types of constructor
    • Default: Data members initialized with default values
    • Constructor with arguments
  9. What happens if no constructor is included?
    Data members are not initialized
  10. Operators that always work with user-defined objects
    • Assignment "=" - Assigns each data member of an object
    • Dot"." - Used to access class members
  11. Two parts of a class
    • Interface (.h)
    • Implementation (.cc)
  12. Struct/record
    A class where all data members are declared public
  13. Compiler directive, to prevent excess copies/code
    • // In the header file
    • #ifndef CLASSNAME_H
    • #define CLASSNAME_H


    • ...
    • #endif
  14. What is, "::"
    • The scope resolution operator
    • Used as a prefix to each function name in the header
  15. Accessor methods should be...
    • constant (const)
    • const className& object //in header and parameters
  16. static members
    • Are the same across all instances of a class
    • Usual members are limited to each instance
  17. Declaring, and using static objects
    • Declaration: static member
    • Accesssing: className::member
    • where member refers to a method or datamember
Card Set
CPSC - Object Oriented Programming