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

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -