二进制运算符使用C ++中的成员函数进行重载 [英] Binary Operator Overloading using member function in C++
本文介绍了二进制运算符使用C ++中的成员函数进行重载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我想创建一个节目,显示总共2个科目&使用二进制运算符在C ++中使用成员函数重载的学生百分比。
解决方案
我需要更多信息。应该做什么二元运算符重载?
对于迟到的回复抱歉。非常感谢你的回复。
我有以下定义: -
写一个显示总数的程序2科目&学生百分比
我必须使用运算符重载来执行此操作。
我必须显示总共2个主题,所以我认为我可以使用+运算符进行添加。并且有2个主题(变量)则它应该是二元运算符重载。我是对的吗?
我想解决上面的定义,但我不明白如何编写这个程序。那么你能为我提供这个定义的代码吗?
谢谢你的帮助。
当你说总共2个科目时你的意思是什么?
另外,什么是学生?
也许它不是你需要的操作员+。
Hello all,
I want to create a program that shows the total of 2 subjects & percentage of student using binary operator overloading with member function in C++.
解决方案
I need more information here. What are the binary operator overloads supposed to do?
Sorry for the late reply. And thank you very much for your reply.
I have the following defination :-
"Write a Program that shows the total of 2 subjects & percentage of student"
I have to use the operator overloading to do this.
I have to display the total of 2 subjects, so I think that I can use the + operator for the addition. and there are 2 subjects(variables) then it should be binary operator overloading. Am I right?
I want to solve the above definition, but I can''t understand how to write this program. So can you provide me the code for this definition?
Thank you for your help.
When you say "total of 2 subjects" what do you mean?
Also, what is a "student"?
Maybe it''s not an operator+ you need.
这篇关于二进制运算符使用C ++中的成员函数进行重载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文