Just as you ask your compiler to make a regular function 'inline' you can make class methods inline. The keyword 'inline' appears before the return type. The inline implementation of the GetWeight() function looks like this;
inline int Cat::GetWeight()
{
return itsWeight;
}
No comments:
Post a Comment