The .h usually has the class definition (code)
#ifndef CLASS_T_H
#define CLASS_T_H
class class_t {
public:
class_t();
class_t(const class_t& o);
~class_t();
class_t& operator=(const class_t& o);
private:
};
#endif
And the .cpp usually has the class implementation (code)
#include "class_t.h"
class_t::class_t() {
}
class_t::class_t(const class_t& o) {
}
class_t::~class_t() {
}
class_t& class_t::operator=(const class_t& o) {
return *this;
}
You could use the class_t in another .cpp file by inclduing the .h file and compiling the cpp files into a binary executable. One of the cpp files would contain your main() method.
7
solved What kind of information is stored in a .cpp file extension? [closed]