separate header & source files are not compiling
Separate header & source files are not compiling; compiler is returning me with an error viz undefined reference to 'MyClass::MyClass()' undefined reference to 'MyClass::myPrint()' please help me out what am i doing wrong ??? :( MyClass.h #ifndef MYCLASS_H #define MYCLASS_H class MyClass { public: MyClass(); void myPrint(); ~MyClass(); protected: private: }; #endif // MYCLASS_H MyClass.cpp #include "MyClass.h" #include <iostream> using namespace std; MyClass::MyClass() { cout<<"Constructor"; } MyClass::~MyClass() { cout<<"Destructor"; } MYClass::myPrint() { cout<<"Hello"<<endl; } main.cpp #include <iostream> #include "MyClass.h" using namespace std; int main() { MyClass obj; obj.myPrint(); return 0; }