I wonder if there is any possibility to create function returning some part of ostream, like in example:
#include <iostream> class Point { public: Point(int x, int y){ this->x = x; this->y = y; } ?? getXY(){ // I wish this function returned ostream return ??; } private: int x,y; }; int main() { Point P(12,7); std::cout << "(x,y) = " << P.getXY(); // (12, 7); } I wish the output was:
(x,y) = (12,7) I don't want getXY() to return any string or char array. May I somehow return part of stream?
std::string?