Lab 12: Prelab Questions


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 Tool.

Code #2: Declare a string data member in Tool named myTool.

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

Code #4: Prototype a constructor for Tool that receives a string parameter named tSquare.

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


Lab Exercise
Report errors to Larry Nyhoff (nyhl@cs.calvin.edu)