有人可以告诉我(*ptr).field
和之间有什么不同ptr->field
吗?我知道它以某种方式连接到静态和动态链接,但我不知道它是什么。有人可以告诉我不同之处并举个例子吗?
编辑:如果我有这个代码:
Point p; //point is a class that derive from class shape
Shape *s=&p;
//there is a diffrence if i write:
(*s).print(); //print is virtual func
s->print(); // the answers will not be the same, why?
天呐!