C ++: przeciążenie operatora ciągu
Czy mogę przeciążyć istniejącą funkcję / operatora w istniejącej klasie?
Próbowałem zrobić:
#include <iostream>
#include <string>
using namespace std;
string& string::operator<<(const string& str) {
this->append(str);
}
Ale to daje mi błąd:
test.cpp:5: error: too few template-parameter-lists
Jak mogę to zrobić? Czy nie mogę?