我还没有能够在这里或通过谷歌找到类似的问题,也许是因为我不知道我是否问正确的问题,所以不知道标题是否正确。但我的代码看起来像这样的工作:将值传递给const引用参数?
Foo * foo = new Foo();
add(*foo); //Couldnt find any similar questions on this syntax?
void add(const Foo & foo){
//What exactly is foo here? How can i manipulate its members, foo. or foo-> ?
}
它的行为就像对象本身,而不是像指针一样。 – EJP
@EJP我澄清了我关于引用类似于指针的观点。 – dasblinkenlight