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 -

Admob interstitials not clickable on Nexus 5 (Android 4.4.2) -

java - MigLayout - selective component fill -