开发者

How to call a non-member function that takes in an object within a method

Say I have a class Student, and I have already declared a non-member function called "function_A" that takes in as an a开发者_C百科rgument, type Student.

Now say INSIDE the Student class, I had a member function, and in it, I wanted to reference the non-member function, "function_A", declared earlier. What would I pass in as the argument (the argument itself must be type Student).

code


Do you mean something like this?

void function_A(Student s);

class Student { 
   void function_A() {
        ::function_A(*this);
   }

if the member function's name is different than function_A, I can't see any problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜