pass by const reference of class
        Posted  
        
            by small_potato
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by small_potato
        
        
        
        Published on 2010-05-21T08:33:43Z
        Indexed on 
            2010/05/21
            8:40 UTC
        
        
        Read the original article
        Hit count: 178
        
c++
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.
© Stack Overflow or respective owner