为什么这个结果为空,控制台中没有显示任何内容?
using System;
using System.Collections.Generic;
using System.Linq; using System.Text;
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
pills sthnew= new pills("name", 25);
System.Console.WriteLine();
Console.ReadLine();
}
class pills
{
private int cena;
private string nazwa;
public int Price{
get { return price; }
set { price= value; }
}
public string Name
{
get { return name; }
set { name= value; }
}
public pills() { }
public pills(string Pname)
{
Pname = name;
}
public pills(string Pname, int Pprice)
{
Pname = name;
Pprice = price;
}
}
}
}
我正在努力写一个课程" Pills"管理和保存有关当前药丸的信息。该类应具有私人领域:药丸名称,药丸价格。
答案 0 :(得分:2)
因为你在控制台中什么也没写 -
System.Console.WriteLine();
答案 1 :(得分:1)
你需要在控制台上写一些内容来查看控制台上的内容:
System.Console.WriteLine("something");