First page Back Continue Last page Graphics
explicit
See, the developers of C++ realized that sometimes, automatic type conversions can get you into trouble.
explicit Stonewt ( double lbs ); // no implicit type conversions.
- Stonewt myCat; // ok
- myCat = 19.6; // Not ok
- myCat = Stonewt(19.6); // ok (explicit conv)
- myCat = (Stonewt) 19.6; // ok (old fashioned)