class overb{ public: virtual overb f(){}//invalide covariant type }; class overd:public overb{ public: virtual overd f(){}//invalide covariant type }; 再看: class overb{ public: virtual overb* f(){}//valide covariant type }; class overd:public overb{ public: virtual overd* f(){}//valide covariant type }; 难道overd 不是 overb吗? 这不正好满足type 的 <=关系吗? 1. overd 对应 overb 2. overd* 对应 overb* 请问1, 和 2 , 有什么不一样?为什么一个是Covariant Return Type,另一个不是呢 ?
m*1
4 楼
大家觉得通过外面的JOB FAIR 找到工作的可能性大吗。 因为 1月 22 号 有一个 JOB FAIR 在 PACE UNIVERSITY ,但是票价要10块钱 不知道通过 JOB FAIR 找到工作的 可能性有多大? 另外我不存在身份问题。
X*r
5 楼
Because an "overd *" can be used in place of an "overb *", but an "overd" cannot be used directly in place of an "overb". (check Liskov substitution principle) Think about this: overd d; overb b = d; And this: overd* pd; overb* pb = pd; They are totally different.
【在 z****e 的大作中提到】 : class overb{ : public: : virtual overb f(){}//invalide covariant type : }; : class overd:public overb{ : public: : virtual overd f(){}//invalide covariant type : }; : 再看: : class overb{
s*0
6 楼
10刀的话 近的话 还是考虑去把 呵呵
z*e
7 楼
五体投地。
【在 X****r 的大作中提到】 : Because an "overd *" can be used in place of an "overb *", : but an "overd" cannot be used directly in place of an "overb". : (check Liskov substitution principle) : Think about this: : overd d; : overb b = d; : And this: : overd* pd; : overb* pb = pd; : They are totally different.
w*m
8 楼
upcasting only applies to pointer
【在 z****e 的大作中提到】 : class overb{ : public: : virtual overb f(){}//invalide covariant type : }; : class overd:public overb{ : public: : virtual overd f(){}//invalide covariant type : }; : 再看: : class overb{
z*e
9 楼
还有reference 啦。
【在 w****m 的大作中提到】 : upcasting only applies to pointer