如何调用在方法中接收对象的非成员函数
假设我有一个 Student 类,并且我已经声明了一个名为“function_A”的非成员函数,该函数接受类型为 Student 的参数作为参数。
现在说在 Student 类中,我有一个成员函数,在其中,我想引用之前声明的非成员函数“function_A”。我将传递什么作为参数(参数本身必须是 Student 类型)。
Say I have a class Student, and I have already declared a non-member function called "function_A" that takes in as an argument, 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).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你的意思是这样的吗?
如果成员函数的名称与
function_A
不同,我看不到任何问题。Do you mean something like this?
if the member function's name is different than
function_A
, I can't see any problem.