您的位置:首页 > 编程语言 > C语言/C++

how to call the member function?( C++ ) . or ->

2010-02-05 14:30 471 查看
// Declare a new object of type Point.
Point ptOrigin;

// Member function calls use the . member-selection operator.
ptOrigin.SetX( 0 );
ptOrigin.SetY( 0 );

// Declare a pointer to an object of type Point.
Point *pptCurrent = new Point;
// Member function calls use the -> member-selection operator.
pptCurrent->SetX( ptOrigin.GetX() + 10 );
pptCurrent->SetY( ptOrigin.GetY() + 10 );
X xobj;xobj.set_i(11);xobj.print_i();// static data members and functions belong to the class and// can be accessed without using an object of class XX::print_si();X::set_si(22);X::print_si();
Technorati : . or ->
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐