I don't know C++ that well, and the book I have on it (Stroustrop, 2nd
ed, I think) is 10 years old at least.
XEmacs has typedefs such as Bytecount and Charcount. Currently they are
just ints but I'd like to introduce some additional type-checking using
C++. In particular, I'd like to define them as classes, with the normal
operators overloaded in normal ways, and to allow free mixing (more or
less) between these types and ints (at the very least, it's reasonable
to pass constant ints to a function expecting a Bytecount or Charcount).
What I don't want is to be able to pass one of them to a function
expecting the other -- but it *should* be possible with an explicit
cast, e.g. (Bytecount) x. Problem is, the "cast operator" that can be
defined on a class seems to define implicit casts, not explicit. Is
there any way to do what I want?
ben