Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

c++ string conversion operator

class Foo {
public:
    operator std::string() const { return "I am a foo!"; }
};
...
Foo foo;
std::cout << foo; // Will print "I am a foo!".
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #string #conversion #operator
ADD COMMENT
Topic
Name
5+3 =