◄Up► ◄Contents► ◄Index► ◄Back► ──────────────────────────────────────────────────────────────────────────── Compiler error C2440 'identifier' : cannot convert from 'type1' to 'type2' The indicated object could not be converted to the required type. This error can be caused by converting a user-defined type to some other type without supplying a conversion operator. A conversion operator should be supplied as shown in the following example for the class X, which returns an integer. Note that a parameter type or a return type is not specified. class X { public: int j; } x; class Y { public: operator int() { return j; } // conversion operator int j; } y; void main() { int i; i = x; // error, x cannot be converted to an int i = y; // OK } -♦-