,因为coordinate类的构造函数有参数,Line必须用初始化列表,因为不用的话,Line调用coordinate类初始化对象的时候无参数传入。 而使用初始化列表可以在初始化对象之前把参数传入。
2015-10-22
我用的不是windows系统,system("pause");没用,所以浅拷贝时console输出如下:
test(10901,0x7fff7838a300) malloc: *** error for object 0x7ffe08404ba0: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6
test(10901,0x7fff7838a300) malloc: *** error for object 0x7ffe08404ba0: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6
2015-10-10