c++ - How to define a type conversion from std::string to a custom type? -
Conversion operator is declared within a class like this:
operator string ();
When declared, they can be defined like this;
Foo :: operator string () {return stringRep; }
How can I define a conversion operator with a string in my custom type?
Write a constructor that takes the string.
Comments
Post a Comment