CS333 - Problem Solving and Object Oriented Programming in C++
[ Home | Schedule | Personal Progress | Search | Glossary | Help ]


Access Control to class members


Given the following program:

class Time {
public:
   Time();                        // constructor
   void setTime( int, int, int ); // set hour, minute, second
   void printMilitary();          // print military time format
   void printStandard();          // print standard time format
private:
   int hour;     // 0 - 23
   int minute;   // 0 - 59
   int second;   // 0 - 59
};
Time startTime, stopTime;

State whether the following statements are correct or incorrect:

  Correct Incorrect
hour = 3;
startTime.minute = 45;
stopTime.setTime(4,23,13);
stopTime = startTime;
printMilitary(stopTime);
Time.printStandard( );
Choose one when done
   

Copyright chris wild 1999.
For problems or questions regarding this web contact [Dr. Wild].
Last updated: November 27, 1999.