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

Editing Python Class in Shell and SQLAlchemy -

uislider - In a MATLAB GUI, how does one implement a continuously varying slider from a GUIDE created .m file? -

import - Python ImportError: No module named wmi -