All pastes #975798 Raw Edit

Miscellany

public text v1 · immutable
·published 2008-04-07 20:06 UTC
rendered paste body
#include <iostream>
#include <time.h>

using std::cout;
using std::endl;

class Time {
 public:
  Time(int value) {setTime();}
  void printTime();
  void setTime() {value=time(NULL);}
 private:
  int value;
 }
 Time::Time(int value) {setTime();}

 void Time::setTime()
 {
   value=time(NULL);
  }

 void Time::printTime()
 {
   cout << "Current time is: "<< ctime(&value) << endl;
 }

int main()
{
  Time t;
  t.printTime();

 return 0;
}