Server IP : 172.16.15.8 / Your IP : 3.135.194.138 Web Server : Apache System : Linux zeus.vwu.edu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Wed Nov 6 14:29:02 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.2.24 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0705) : /home/acyurksaitis/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
#include <iostream> // super class using namespace std; class Time { private: int hrs; int mins; int secs; public: // constructors Time () // default constructor { hrs = mins = secs = 0; // 0:0:0 } Time ( int h, int m, int s ) // general constructor { hrs = h; mins = m; secs = s; } // function members void Set(int h, int m, int s) // transformer { hrs = h; mins = m; secs = s; } void Write() const // observer { cout << hrs << ':' << mins << ':' << secs; } bool Equal ( Time x ) const // observer { return ( hrs == x.hrs && mins == x.mins && secs == x.secs ); } }; // declare ZONE type ( time zone: est, pst, etc....) enum ZoneType { EST, CST, MST, PST, EDT, CDT, PDT }; // sub class class extTime : public Time { private: // may be omitted ZoneType zone; public: // constructors extTime() // default EST 00:00:00 { zone = EST; } extTime( int h, int m, int s, ZoneType z ) : Time( h, m, s) // invoke the constructor of Time { zone = z; } }; // DRIVER or CLIENT CODE int main() { cout << "Hi." << endl; return 0; }