Dale - Computer Science Illuminated 200

Dale - Computer Science Illuminated 200 - izing itself. The...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
6.3 Object-Oriented Design 173 Class Name: Person Superclass: Subclasses: Responsibilities Collaborations Initialize itself (name, address, telephone, e-mail) Print Name, Address, Telephone, E-mail Name, Address, Telephone, E-mail on the list. But this train of thought leads to the discovery that we have missed a major clue in the problem statement. A possessive adjective, person’s, actually names a major class; name, address, telephone, and e-mail are classes that help define (are contained within) a person class. Now we have a design choice. Should the person class use the input object(s) to initialize itself or should the input object create the person object with the appropriate data? Let’s let the person class be responsible for initial-
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: izing itself. The person class must also be responsible for printing itself. Does the person class collaborate with any other class? This depends on how we decide to represent the data in the person class. Do we represent name, address, telephone, and e-mail as simple data items within person or do we represent each as a class? Let’s temporarily represent each as a class. We may rethink this when we implement the design in a programming language. Let’s make each class responsible for initializing and printing itself. Class Name: Name Superclass: Subclasses: Responsibilities Collaborations Initialize itself (name) Print itself String String...
View Full Document

This note was uploaded on 01/13/2011 for the course CSE 1550 taught by Professor Marianakant during the Fall '10 term at York University.

Ask a homework question - tutors are online