I am have created two classes, Room and Customer. Room has Customer as data member and Customer also has Room as data member. I have created seperate cpp files for each class. When i compile my main.cpp, it says " undefined reference to `Room::Room()' ".
Room.h file
class Customer;
class Room{
private :
Customer *obj1;
public:
Room();
}
Customer.h file
class Room;
class Customer{
private:
Room *obj;
};
Room.cpp file
Room::Room(){ obj1->setName(a); // this line has the problem}
main.cpp file
#include "Room.h"
#include <iostream>
using namespace std;
int main()
{
Room a;
}
Note: In customer class i have written the code for setName function along with constructors.