Lab 11: Prelab Questions

Write out your answers for these questions on a separate piece of paper.


Written Questions

Question #1: An attribute of an object is represented as a(n) ____________ in a class.

Question #2: An operation of an object is represented as a(n) ____________ in a class.

Question #3: A(n) ____________ is a special class function that constructs a new object.

Question #4: A(n) ____________ is a simple class function that returns a simple value, often an attribute.

Question #5: ____________ is the ability to use the same name for a function in more than one declaration, as long as the parameter lists are different.

Programming Exercises

These exercises have you write one class. You may give one complete class to answer all five questions.

Code #1: Write a class definition for a class named Movie.

Code #2: Declare a string instance variable in Movie named myTitle.

Code #3: Prototype a constructor for Movie that receives no parameters.

Code #4: Prototype a constructor for Movie that receives a string parameter named title.

Code #5: Prototype an accessor for Movie named getMovie() that returns a string and takes no parameters.


Lab Home Page | Lab Exercise | Homework Projects
© 2003 by Prentice Hall. All rights reserved.
Report all errors to Jeremy D. Frens.