Lecture #5 - Abstract Data Types (continued)

Web Resources:

CppReference.com, CPlusPlus.com, C++ TechLinks
Going Native 2013 - many experts
Herb Sutter's Blog, Herb Sutter on C++11, Herb Sutter keynote - Going Native 2012
Scott Meyer's Blog, S.M. on thread suspension, S.M.: C++11 Sampler
Stroustrup's Home Page, Code Project, Boost Library

Content:

This lecture finishes Abstract Data Types, then presents templates, a type safe replacement for macros. We will show later in the course how templates are used in the Standard Template Library to provide a powerful set of algorithms and data structures.
  1. useful C++ reference
  2. Syllabus
    Describes topics to be covered, reading material for you to digest before coming to class, and due dates for the assigned projects.
  3. Help Session this Friday: 1st group at 9:00 am in CST 4-201, 2nd group at 10:30am

  4. Project #1

  5. Top-Down Design, Bottom-up Design, Incremental Development
  6. Abstract Data Types

    Abstract Data Types Presentation, pptx
    What does it take to make objects of your class behave like built in types?

    STR class
    This is a good example of an ADT. It is presented as a nice example. You should prefer the std::string class for all your development work.

    C++ Operators, ppt

    vector3D
    An example of an Abstract Data Type that is rich in operators. Shows the accepted style for building ADT classes with mathematical operations.

  7. New style casts:

    new-style casts: demo code

    There are four distinct things the new-style casts provide:

    • static_cast:
      1. converts a foreign type to a type defined by a class with a promotion constructor
      2. converts an instance of a type that provides a cast operator to a foreign type
    • const_cast:
      Provides a non-const reference to a const object. That allows you to apply a non-const function to a const object.
      Please don't do that unless you are sure the the non-const function won't change the const object.
    • reinterpret_cast:
      Treat an instance of one type by the rules of another type.
    • dynamic_cast:
      Support safe downcasting from a base pointer or reference to a derived pointer or reference.
  8. Namespaces
    Basic information about how namespaces work. We will discuss why you want to use them.
  9. Software Design
  10. Design Rules
    Design rules and idioms that transcend Object Oriented Design.
  11. Templates Presentation
    Templates are one of the terrific features of the C++ language. They are the basis of the Standard Template Library (STL) and are useful in day-to-day programming.
  12. These are the most important items from today's lecture:

    Abstract Data Types Presentation, pptx
    What does it take to make objects of your class behave like built in types?

    STR class
    This is a good example of an ADT. It is presented as a nice example. You should prefer the std::string class for all your development work.

CST strip