0

I am having trouble finding out what it means when you overload a type name. This is what I am talking about.

using type_x = uint32_t;

//class instance variable initialized in constructor
type_x variable;

//later on in cpp file (this is my question)
inline ClassX::operator type_x () const { return variable; }
Bob Bobby
  • 134
  • 1
  • 10

1 Answers1

0

The code in question is overloading a cast operator. It allows you to cast your class as the given type, in this case type_x, and receive a meaningful result.

You can find information here: http://en.cppreference.com/w/cpp/language/cast_operator

Mikel F
  • 3,567
  • 1
  • 21
  • 33