Well, here is an example of a basic header file.
Code:
// Example.h
#ifndef _EXAMPLE_H_ // says, if it isn't defined, define
#define _EXAMPLE_H_
class cExample {
private:
int m_x;
int m_y;
public:
inline int GetX( void ) { return ( m_x ); }
inline int GetY( void ) { return ( m_y ); }
};
#endif /* _EXAMPLE_H_ */
This might seem a little confusing at first but basically this is just a simple class that your main.cpp file can use. Make sure you add the line
#include "Example.h"
to your main.cpp in the beginning. Using quotes as opposed to the brackets you are accustomed to means that it is a header file you defined and is located in the directory your source code is located in. Now if I wanted to declare an instance of this class in my main.cpp you would write it like this.
Code:
int main( void )
{
cExample cEx;
return ( 0 );
}
This would declare an instance of the class and you could access the public members as you normally would. Hopefully this helps you some.