class StudentPtr;
class Student
{
private:
//variables
public:
//constructor and other things
StudentPtr &getPointer();
};
StudentPtr &Student::getPointer()
{
StudentPtr *stu = new StudentPtr(this);
return stu;
}
class StudentPtr
{
private:
Student *ptr;
public:
StudentPtr(Student *stu) :ptr(stu){}
};
When I try to compile this I get an error that says that the StudentPtr constructor has not been defined yet. Is there a way to do this without putting getPointer after the StudentPtr declaration?