hi, its probably some silly mistake in c++ but my code is not working, it gives me error.
here is code
_time.h
#ifndef _TIME_H
#define _TIME_H
#include <QObject>
#include <QTimer>
{
Q_OBJECT
public:
_Time();
_Time(int sec=0,int min=0,int hour=0);
int hour;
int min;
int sec;
};
#endif // _TIME_H
#ifndef _TIME_H
#define _TIME_H
#include <QObject>
#include <QTimer>
class _Time : public QObject
{
Q_OBJECT
public:
_Time();
_Time(int sec=0,int min=0,int hour=0);
int hour;
int min;
int sec;
};
#endif // _TIME_H
To copy to clipboard, switch view to plain text mode
_time.cpp
#include "_time.h"
_Time::_Time()
{
hour=0;
min=0;
sec=0;
}
_Time::_Time(int s, int m, int h)
{
if (h > -1)
hour=h;
else
hour=0;
if ((m > -1) && (m<60))
min=m;
else
min=0;
if ((s > -1) && (s<60))
sec=s;
else
sec=0;
}
#include "_time.h"
_Time::_Time()
{
hour=0;
min=0;
sec=0;
}
_Time::_Time(int s, int m, int h)
{
if (h > -1)
hour=h;
else
hour=0;
if ((m > -1) && (m<60))
min=m;
else
min=0;
if ((s > -1) && (s<60))
sec=s;
else
sec=0;
}
To copy to clipboard, switch view to plain text mode
main.cpp
#include "_time.h"
_Time t;
int main(int argc, char *argv[])
{
return 0;
}
#include "_time.h"
_Time t;
int main(int argc, char *argv[])
{
return 0;
}
To copy to clipboard, switch view to plain text mode
i get error:
_Time does not name a type.
any suggestions? thanks in advance
Bookmarks