Unit 15 Test - UNIT15TEST 1. a(true/false)...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
UNIT 15 TEST 1. Answer the follow questions. a. (true/false) Class declarations always end with a semicolon. b. (true/false) Since #include simply adds the code to the top of your program before compiling, you  could simply declare your class at the top of your main.cpp file. c. Where in your code can you call a method that is private? d. (true/false) A class can have multiple Constructor e. (true/false) The following line of code (cout << *this << endl;) in a class method will only compile if  the << operator is overridden for that class. a) True b) True c) In a classes' methods. d) True  e) True 2. Correct the following header file class declaration. Correct both design and  syntax errors. #ifndef TIME_H #define TIME class Time; { private: Time( int hour, int minute, float second ); Time( ); Time TimeElapsed( double stopTime ); float GetSeconds( ); float GetMinutes( ); void GetHours( ); void PrintTime( ) public: int hour; double minute; int second = 0; };
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
#endif Submit the code for Time.h that will compile when used with the following  main.cpp code.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/02/2011 for the course ME 205 taught by Professor Koen during the Spring '07 term at University of Texas.

Page1 / 6

Unit 15 Test - UNIT15TEST 1. a(true/false)...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online