A const reference can only call const member function.
void f(const Car& b) {
b.GetName(); // ok
b.StartEngine();// compile error
}
class Car {
const char* GetName() const; // const member function
void StartEngine();
posted by fatboy401 @ 9:03 PM 0 comments
Post a Comment
<< Home
View my complete profile
0 Comments:
Post a Comment
<< Home