pass by const reference of class
- by small_potato
void foo(const ClassName &name)
{
...
}
How can I access the method of class instance name?
name.method() didn't work. then I tried:
void foo(const ClassName &name)
{
ClassName temp = name;
... ....
}
I can use temp.method, but after foo was executed, the original name screwed up, any idea?
BTW, the member variable of name didn't screwed up, but it was the member variable of subclass of class screwed up.