class Building { private string address; private int floors; private int completionYear; private string owner;

public Building(string owner)
{
    this.owner = owner;
}

public string Address
{
    get { return address; }
    set { address = value; }
}

public int Floors
{
    get { return floors; }
    set { floors = value; }
}

public int CompletionYear
{
    get { return completionYear; }
    set { completionYear = value; }
}

public string Owner
{
    get { return owner; }
}

public void DisplayInformation()
{
    Console.WriteLine('Address: {0}', address);
    Console.WriteLine('Floors: {0}', floors);
    Console.WriteLine('Completion Year: {0}', completionYear);
    Console.WriteLine('Owner: {0}', owner);
}

}

C# 控制台应用:建筑物类定义示例

原文地址: https://www.cveoy.top/t/topic/oerT 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录