指针与引用
1. 有了指针为什么还要用引用
from bj:
the direct reason i introduced them in c++ was to support operator overloading.
直接原因是为了支持操作符重载。
比如:
A operator +(const A *a, const A *_a);
那么使用的时候,&a + &b,这样看起来是不是很难受。
2. 有了引用为什么还需要指针
为了兼容c语言
1. 有了指针为什么还要用引用
from bj:
the direct reason i introduced them in c++ was to support operator overloading.
直接原因是为了支持操作符重载。
比如:
A operator +(const A *a, const A *_a);
那么使用的时候,&a + &b,这样看起来是不是很难受。
2. 有了引用为什么还需要指针
为了兼容c语言