Do you know what a function prototype is? Anyway, here's the basics: http://www.cplusplus.com/doc/tutorial/functions/
I despise function objects. They're just so ridiculous. Redefining the call operator is a violation of the call operator's original purpose - calling a function. (That's just my opinion.) But you could theoretically accomplish this with a special time wrapper class of your own. I'd prefer a function but you could set up a constructor to generate a time wrapper of the current time (however, if you don't know how to implement a function I'd hold off on classes for now).
I am not sure If I am understanding you correctly...
But any way...
I'd prefer a function but you could set up a constructor to generate a time wrapper of the current time
Again... I am not trying to print the current time...
I am trying to set the current time as a variable using a class or a function prototype ( I would prefer a class)
I would like to do this using only one class or Funct. Prototype.
you want to pack your data into a class and return that class from a function, so the caller of that function can get the data (for example day and hour) out of the class?...
after i read again, its a YES...
so put ur variables (like M1, Y1 etc) into a class as members and the code
into your constructor or an member function - if u want it to be set manually...
if you specify the member variables as public you can access them directly by using object.member;
or you could use data hiding and set them to private or protected and get them returned from the individual member functions... like unsignedshort GetMonth(){return M1;};
'Time' is a class. By doing Time t; you create an object of that class (called t). This is just like making a variable with int foo; or string bar;, but instead of making an int or a string, you're making a 'Time' object.
This time object takes a "snapshot" of the current time when you create it. That time can be read back through the various functions.
Where does the Time t; go...
Wherever you want the snapshot of the current time.
and can't Time t; be Time::t
No. Time t; creates an object as previously explained.
Time::t accesses 't' which is a member of the Time class. But you'll notice that Time doesn't have any member named 't', so it's nonsense.