I have a header file and a cpp file. In the .h
file I declared a class and a function with returning a reference:
.h
file:
#include <iostream>
class testclass {
Car &createCar(int x, int y);
}
.cpp
file:
#include<testclass.h>
Car testclass:&createCar(int x, int y)
{
....
}
But when I try to access the function in the .cpp
file I get an error:
Declaration is not compatible