Sams Teach Yourself C++ in 21 Days

(singke) #1

  1. This operator+is changing the value in one of the operands, rather than creating a
    new VeryShortobject with the sum. The correct way to do this is as follows:
    VeryShort VeryShort::operator+ (const VeryShort& rhs)
    {
    return VeryShort(itsVal + rhs.GetItsVal());
    }


Day 11


Quiz


  1. Procedural programming focuses on functions separate from data. Object-oriented
    programming ties data and functionality together into objects, and focuses on the
    interaction among the objects.

  2. The phases of object-oriented analysis and design include conceptualization, which
    is the single sentence that describes the great idea; analysis, which is the process of
    understanding the requirements; and design, which is the process of creating the
    model of your classes, from which you will generate your code.
    These are followed by implementation, testing, and rollout.

  3. Encapsulation refers to the (desirable) trait of bringing together in one class all the
    data and functionality of one discrete entity.

  4. A domain is an area of the business for which you are creating a product.

  5. An actor is any person or system that is external to the system you are developing
    and interacts with the system you are developing.

  6. A use case is a description of how the software will be used. It is a description of
    an interaction between an actor and the system itself.

  7. A is true and B is not.


Exercises


  1. The following diagram provides one possible answer:


842 Appendix D

Computer
System

Keyboard Mouse Monitor CPU

1 1 1..2 1..8

32 0672327112_app_d.qxd 11/19/04 12:30 PM Page 842

Free download pdf