#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
oneclass.hello();
return 0;
}
class one
{
private:
int num;
public:
void hello();
}oneclass;
void one::hello()
{
num++;
cout << num;
}
Could anybody please please tell me what is wrong with this code. I think it is correct but keep getting errors:
Error 2 error C2228: left of '.hello' must have class/struct/union f:\documents and settings\j\my documents\visual studio 2008\projects\ex2\ex2\ex2.cpp 18
Error 1 error C2065: 'oneclass' : undeclared identifier f:\documents and settings\j\my documents\visual studio 2008\projects\ex2\ex2\ex2.cpp 18