C++ classes
Hello I am studing C++ in school and I am having a lot of problems
with classes. I was wondering if anyone could help me out with my
program. I keep getting this error and I do not know why:
request for member `input_time' in `current', which is of non-class
type `Military ()()'
Here is the program (for reference this is not anywhere close to
complete I just try to compile once I get a little done to check for
big errors.)
header:
#include<fstream>
#include<iostream>
using namespace std;
class Military
{
public:
//Constructor Function to initialize a data object
Military();
Military(int, int, int);
void input_time(istream& fin);
void print_time(ostream& fout);
void print_normal_time(ostream& fout);
private:
int minute;
int second;
int hour;
};
file with functions:
/* Date class implementation (Milirary.cpp) */
#include "Military.h"
using namespace std;
Military::Military()
{
hour = 1;
minute = 1;
second = 1;
}
Military::Military(int h, int m, int s)
{
hour = h;
minute = m;
second = s;
}
void Military::input_time(istream& fin)
{ char ch;
fin >> hour >> ch >> minute >> ch >> second;
}
void Military::print_time(ostream& fout)
{
fout << hour << ':'
<< minute << ':' << second;
}
void Military::print_normal_time(ostream& fout)
{
fout << hour << ":" << minute << ":" << second;
}
main
#include <cstdlib>
#include <iostream>
#include "military.h"
using namespace std;
int main(int argc, char *argv[])
{
Military current();
current.input_time(cin);
current.print_time(cout);
system("PAUSE");
return EXIT_SUCCESS;
}
any help would be great.
Thanks
Pat
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]