如何实现一个类? [英] how to implement a class??

查看:86
本文介绍了如何实现一个类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个 class 雇员,然后在主form.cs上创建了一个show方法,现在我不知道如何设置给TextBox命名的名称控制.我应该在show方法中写些什么以在TextBox中显示姓名和年龄,以及在main()form_load中写什么?

I created a class employee then on main form.cs I created a show method now I don''t know how to set the name I give to a TextBox control. What should I write in show method to display name and age in TextBox and what should I write in main() and form_load?

class employee
{
    string name;
    int age;
    public string Name
    {
        get { return name; }
        set { name = value; }
    }
    public int Age
    {
        get { return age; }
        set { age = value; }
    }


我只是一个初学者,所以需要帮助.

[代码格式]


I''m just a beginner so help needed.

[Code formatting]

推荐答案

请购买好书,以阅读/学习.NET.
或网上有很多教程可供学习!

Please buy good books to read/learn about .NET.
Or there are lots of tutorials on web to learn!

Learn .Net C# tutorial[^]


class employee
{
    string name;
    int age;
    public string Name
    {
        get { return name; }
        set { name = value; }
    }
    public int Age
    {
        get { return age; }
        set { age = value; }
    }


这篇关于如何实现一个类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆