M*******8 发帖数: 85 | 1 class A {
public:
A();
A(int x);
operator int& ();
};
A object =7;
what happens to "object" ? |
a********1 发帖数: 750 | 2 A(int x) called
【在 M*******8 的大作中提到】 : class A { : : public: : A(); : A(int x); : operator int& (); : }; : A object =7; : what happens to "object" ?
|
s*****r 发帖数: 773 | 3 啥意思?
【在 M*******8 的大作中提到】 : class A { : : public: : A(); : A(int x); : operator int& (); : }; : A object =7; : what happens to "object" ?
|
s*****r 发帖数: 773 | 4 A(int x) will be called. There is an implicit conversion from 7 to the
object.
【在 M*******8 的大作中提到】 : class A { : : public: : A(); : A(int x); : operator int& (); : }; : A object =7; : what happens to "object" ?
|
M*******8 发帖数: 85 | 5 thanks
what does operator int& () mean pls?
【在 s*****r 的大作中提到】 : A(int x) will be called. There is an implicit conversion from 7 to the : object.
|
s*****r 发帖数: 773 | 6 it means an implicit conversion from the object to the int.
google 'conversion operator'
【在 M*******8 的大作中提到】 : thanks : what does operator int& () mean pls?
|