Hi I have a bachelor project about DJI Tello Drone and I wanted to overload this "<<" operator so that I can call the function like this:
1 2 3 4 5
|
int main(){
Tello drone;
drone<<command();
return 0;
}
|
and not like this:
1 2 3 4
|
int main(){
drone.command();
return 0;
}
|
The Tello is a class and here is the definition:
1 2 3 4 5 6 7 8 9 10
|
class Tello
{
public:
tello();
void Command();
tello operator<<(string(*command)(void));
private:
string command;
void SendCommand(const string&);
};
|
1 2 3 4 5 6 7 8 9 10 11
|
tello::tello(){}
void tello::Command()
{
command = "command";
}
tello tello::operator<<(string(*command)(void))
{
SendCommand();
return tello();
}
|
Last edited on
I am actually using function pointer or std function...