- 3
- 0
- 约3.48千字
- 约 30页
- 2018-12-26 发布于福建
- 举报
运算符重性载和自定义类型变换
;运算符重载;;;可重载的运算符; public class Complex
{
public int real;
public int imaginary;
public Complex(){ }
public Complex(int real, int imaginary) {
this.real = real;
this.imaginary = imaginary;
}
public static Complex operator +(Complex c1, Complex c2)
{
return new Complex(c1.real+c2.real, c1.imaginary +c2.imaginary);
}
public static Complex operator -(Complex c1, Complex c2)
{
return new Complex(c1.real-c2.real, c1.imaginary -c2.imaginary);
}
public override string ToString(){
return(String.Format({0} + {1}i,
您可能关注的文档
最近下载
- 特色小镇之云栖小镇概念规划案(上).pdf VIP
- 2025版中国视网膜中央动脉阻塞临床诊疗专家共识学习与解读PPT课件.pptx VIP
- 中国视网膜中央动脉阻塞临床诊疗专家共识.pptx VIP
- 特色小镇之云栖小镇概念规划课件.ppt VIP
- 2026年导游资格考试地方导游基础知识真题精选及答案.docx VIP
- 特色小镇之云栖小镇概念规划案(下).pdf VIP
- 水电站厂内经济运行解析.pptx VIP
- 2026年水电站经济运行与管理策略.pptx VIP
- Samsung三星滚筒洗衣机 博慕系列 br 洗干一体机钛晶灰 br WD10N64GT3X用户手册.pdf
- 一年级上册卷面综合练习硬笔书法练字帖.pdf VIP
原创力文档

文档评论(0)