using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Constructor
{
class Dog
{
//构造函数,等价于默认构造函数
public Dog()
{
System.Console.WriteLine("\tDog():{0}---{1}", this._Name, this._Weight);
this._Weight = 20;
}
//带参数构造函数,初始化姓名和体重
public Dog(string name, int wt)
C#基础知识之构造函数Constructor
最新推荐文章于 2025-06-29 14:43:38 发布