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

c# - Highlight all words containing a letter in a richtextbox -

Editing Python Class in Shell and SQLAlchemy -

java - JavaFX WebEngine Video Playback in Linux -