E.i
Put this in your header-file file1.h (prefix *.h is compiler dependent, se documentation for yourīs compiler)
Code:
//This is called the declaration for the class
class Test
{
public:
Test(int pNumber);
int getNumber() const;
private:
int mnumber;
};
and this in file.cpp
Code:
//Respectivly this is called the implementation of the class
Test::Test(int pNumber)
{
mnumber = pNumber;
}
int Test::getNumber() const
{
return mnumber;
}
And if you want to use this class in main()
Code:
#include <iostream>
//Now you can use the class Test
#include "file1.h"
int main()
{
Test anobject(10);
return 0;
}