C++ Chapter 10 & 11 cont: ADTs and Inheritance

  1. A data type is called an ADT if a programmer who uses the data type does not have access to the details of how the values and operations are implemented.
  2. ADT Components:
    1. Variables are private.
    2. Functions are public.
    3. Helping functions are private.
  3. Inheritance is the process by which a new class is created from another class, but the new class has additional member variables and/or functions.
  4. A Class is a definition of a new data type. The definition inlcudes member variables and functions.Image Upload 1Image Upload 2Image Upload 3Image Upload 4Wikipedia: C.L.A.S.S is a 2010 American horror film starring Tom Sizemore, and Paige La Pierre and was directed from Michael Phillip Edwards.
  5. An Object is a variable declared using a class as the data type.
  6. Inheritance is the process by which a new class is created from another class, but the new class has additional member variables and/or functions.
  7. Inheritance allows us to reuse C++ code that has already been developed and tested.
  8. Inheritance Terminology:
    Base Class --------------> Derived Class
    Parent Class --------------> Child Class
    Super Class --------------> Sub Class
  9. A Derived Class would be able to do everything the base class can do, plus it would add some attributes or operations to increase its functionality.
  10. Why do we need to know what each stream class inherits?
    So we can understand the possibilities and limitations when writing functions that use classes as parameters.
  11. A data type consists of a collections of values together with a set of basic operations defined on those values.
  12. The interface of an ADT tells you how to use the ADT in your program.
  13. The implementation of the ADT tells how the interface is realized as C++ code. The implementation of the ADT consists of the private member of the class and the definitions of both the public and private member functions.
  14. The most obvious benefit you derive from making your classes ADTs is that you can change the implementation without needing to change the other parts of your program.
  15. A Derived Class is defined by adding a colon followed by the keyword public and the name of the parent or base class:
    class ChildClass : public ParentClass
    {
    public:
    private:
    };
  16. A function can be overloaded to take arguments of different types. An operator is really a function, so an operator can be overloaded. The way you overload an operator, such as +, is basically the same as the way you overload a function name.
    friend ClassName operator +(const ClassName& objectName1, const ClassName& objectName2);
  17. When you add an & to the name of a returned type, you are saying that the operator (or function) returns a reference, which means that you are returning the object itself, as opposed to the value of the object.
Author
senator77
ID
146208
Card Set
C++ Chapter 10 & 11 cont: ADTs and Inheritance
Description
C++ Chapter 10 & 11 cont: ADTs and Inheritance
Updated