小编jae*_*aen的帖子

如何使用方法返回字符串

我正在编写一个名为Television的类,该类具有一些简单的控件,但是我的ToString方法遇到了问题。“'Television.ToString()':并非所有代码路径都返回值”。我将如何退回任何一条消息?非常感谢任何帮助,谢谢。

class Television
{
    private string manufacturer;
    private int screenSize;
    private bool powerOn = false; // the power is off by default
    private int channel = 2;  // channel is default set to 2
    private int volume = 20;  // volume default set to 20

    public Television (string manu, int size) // The purpose of this constructor is to initialize the manufacturer and screen size fields.
    {
        manufacturer = manu;
        screenSize = size;
    }

    public int GetVolume() // accessor method …
Run Code Online (Sandbox Code Playgroud)

c# methods

0
推荐指数
1
解决办法
45
查看次数

标签 统计

c# ×1

methods ×1