z****e 发帖数: 2024 | 1 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,另一个不是呢
? |
|
X****r 发帖数: 3557 | 2 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. |
|
|
b**u 发帖数: 12 | 4 早上天还没很亮去上班,我在等红灯的时候,被后面的车撞了一下. 我们两个把车pull
overd到停车场。下来一个黑人女的,说我的车后退才撞到一起。事实是我没有block
那个intersection,也没有有行人要让,那条路也没有坡,怎么都 不可能溜坡。她说我
们两个车都没有损坏,就想拍拍屁股走人。我就说你至少say sorry吧。但她还是一口
咬定说是我的错。在我的坚持下,她call 了911。但是她跟警察说话的时候不让我听到
她在讲什么。警察让我听电话的时候,没有说什么,就让我们交换了下信息,各自离开
,都不愿到现场。到了办公室,天已经很亮了,我才看到被蹭掉了一点漆。现在我已报
告给insurance company, w我还要做什么? |
|
d********0 发帖数: 3743 | 5 生了呀?林阿姨现在在你家不?
一转眼老二都快百天了,拖拉着一直没写产经,其实生产过程确实乏善可陈,生过2胎
以上的妈妈都知道,老二一般要比老大容易生,比如我,两个娃都是开1指进医院催产
的(老大是因为overd........ |
|
t*****7 发帖数: 147 | 6 恭喜
我也是糖妈
好奇怪看到很多糖妈都是fasting难控制,我fasting却从来没超过,天天在65左右
吃饭后就完了,几次达到200了
一转眼老二都快百天了,拖拉着一直没写产经,其实生产过程确实乏善可陈,生过2胎
以上的妈妈都知道,老二一般要比老大容易生,比如我,两个娃都是开1指进医院催产
的(老大是因为overd........ |
|
|
a***e 发帖数: 2094 | 8 oops...i did notice that, which is very encouraging.
"Ke Qiang Shao & Na Yang (China)
have improved in that they refrained from overd
oingMalki-UK.jpg much of their dancing as
I have seen them do before. "
"Sonny Jin Zhang & Cher Wen Qing Luo (China)
had a strong Paso with very clearly
defined shapes. I enjoyed watching them as
the man had an especially nice delivery of
his dance movements. " |
|