There are three types of C ++ member function: static / nonstatic / virtual
A variety of ways to call a member of the
C with class supports only non-static member function (Nonstatic member function), 20 mid-1980s, and the introduction of a virtual function, but there is a common view is: virtual function pointer is just a lame, no use. In 1980, static member function is finally introduced.
1.1 non-static member function
设计准则之一就是非静态成员函数必须具有与一般非成员函数具有相同的效率,选择成员函数不应该带来任何额外的负担。这是因为编译器会将成员函数实例转换为对应的非成员函数实例。
float Point3d::magnitude() const {
return sqrt(_x * _x + _y * _y + _z * _z);
};