Pointers, Classes, and Errors o my!
Ok heres my class under header files as P1.h:
typedef unsigned long int ULONG;
class P1;
{
public:
ULONG* pointer;
pointer=&h;
private:
ULONG h, m, s;
return 0;
}
Now heres main.cpp:
#include <iostream.h>
#include "p1.h"
int main()
{
P1 test;
test.pointer = 100;
cout << "test.pointer = " << test.pointer;
return 0;
}
Now heres the annoying errors I get:
--------------------Configuration: PointerNClass - Win32 Debug--------------------
Compiling...
main.cpp
c:\program files\microsoft visual studio\myprojects\pointernclass\p1.h(5) : error C2447: missing function header (old-style formal list?)
c:\program files\microsoft visual studio\myprojects\pointernclass\main.cpp(6) : error C2079: 'test' uses undefined class 'P1'
c:\program files\microsoft visual studio\myprojects\pointernclass\main.cpp(7) : error C2228: left of '.pointer' must have class/struct/union type
c:\program files\microsoft visual studio\myprojects\pointernclass\main.cpp(8) : error C2228: left of '.pointer' must have class/struct/union type
Error executing cl.exe.
PointerNClass.exe - 4 error(s), 0 warning(s)
I am trying to learn pointers and classes. They are hard to understand and I cant figure this one out.