Finally Made it!!!
I just started taking my first OO class and I just want to be sure I have some of the basics down before moving on.
Code:
Class Time
{
Private:
int hour,
min,
sec;
Public:
Time ( ) { hour = 0, min = 0, sec = 0}
Void load ( )
{
cout << “\n Enter Hour: “; cin >> hour;
cout << “\n Enter Minutes : “; cin >> min ;
cout << “\n Enter Seconds: “; cin >> seconds;
}
void showitem ( )
{
cout << hour << min << seconds;
}
};
int main ( )
{
time t1;
t1.load ( );
t1.showitem ( );
return 0;
}
Ok so based on this simple class that I believe I have coded correctly? Is the following correct as well.
1. hour, min, sec = Data members?
2. load, showitem = Function members?
3. load, showitem = Members of t1?
4. t1 is the owner of these Function Members?
5. The object in this program is the entire Time class? Or are there more than one objects?
This basically just looks like some weird structure to me.
Any help is as always greatly appreciated. If there is anything else you can expand on thanks in advance.