C#.net中的运算符重载有什么用? [英] what is use of operator overloading in C#.net ?

查看:449
本文介绍了C#.net中的运算符重载有什么用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要明确的相关答案,请帮我

I need clear related answer plz help me

推荐答案

我从本文引用:

请参阅本文以获取更多信息以及如何实际实现运算符重载.
I''m citing from this article: A Beginner''s Tutorial on Operator Overloading in C#[^]:

"In an object oriented programming language like C#, operator overloading provides a much more natural way of implementing the operations on custom types. Suppose that we have a class created for Complex number and we want to perform all the arithmetic operations on this type. One way to do this is by having functions like Add, Subtract inside the class and have the functionality. Another way is to actually have the overloaded version of operators to act on this type."

Please refer to the article for further information and how to actually implement operator overloading.


有很多不错的文章,如下所示.阅读它们并进行研究.
1.
有关C#中运算符重载的初学者教程 [ ^ ]
2. C#中的运算符重载简介 [ ^ ]
There are many nice articles like below. Read them and do some research.
1. A Beginner''s Tutorial on Operator Overloading in C#[^]
2. An Introduction to Operator Overloading in C#[^]


这篇关于C#.net中的运算符重载有什么用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆