Questions tagged «object-slicing»


8
指针和引用参数之间的区别?
这些是一样的吗: int foo(bar* p) { return p->someInt(); } 和 int foo(bar& r) { return r.someInt(); } 忽略空指针电位。这两个函数在功能上是否相同,无论someInt()是虚拟的还是传递给bar的子类bar? 这个切片什么吗? bar& ref = *ptr_to_bar;
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.