构造函数

LesterYu 2003-07-30 08:39:31
请问如何使一个类有多个构造函数?
...全文
56 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
matson 2003-07-30
  • 打赏
  • 举报
回复
只有重載
雪狼1234567 2003-07-30
  • 打赏
  • 举报
回复
举下例子吧:
class Rectangle
{
protected int width =1;
protected int height = 1;
public Rectangle(){}
public Rectangle(int cx,int cy)
{
width = cx;
width = cy;
}
}
panyee 2003-07-30
  • 打赏
  • 举报
回复
public Form1()
{
//标准的
}

//带参数的
public Form1(string str){}

public Form1(int i){}

public Form1(string str, int i){}
xixigongzhu 2003-07-30
  • 打赏
  • 举报
回复
public class method{
public method(){
}

public method(long icon,int n){
}

public method(long icon,bool a,int b,int c){
}
}

110,524

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧