Я пытаюсь передать класс, имеющий шаблон, в функцию как объект, который находится в другом классе.Другими словами, я хочу передать объект Device
в функцию-член Sendo
с именем connect
.
device.h
#ifndef DEVICE_H
#define DEVICE_H
template<class T> class Device{
public:
T target;
std::string address;
Device(std::string address) : address(address){
target = new T;
}
bool coonect(){
target.connect(address)){
connected = true;
}
}
};
#endif // DEVICE_H
sendo.h
#ifndef SENDO_H
#define SENDO_H
#include "device.h"
class Sendo{
public:
Sendo(){
}
bool connect(Device target){
target.connect();
}
};
#endif // SENDO_H
Проблема
g ++ компилятор показывает мне ошибку в файле sendo.h
и функции connect
:
`Device` is not a type
Как я могу решить эту проблему?