cod*_*ded 3 c# oop methods programming-languages
我是C#的新手.将main()方法放在"类"中的目的是什么.不会为这个"所谓的"类创建任何对象.我不知道为什么他们将整个程序视为类和方法.另外为什么main()函数被称为方法?显然它是在课堂上,但我总是把它称为一个功能.像这样:
using System;
public class MyApp // What is the purpose of this class?
{
public static void main() // Why is this called a method & not a function when no objects use it?
{
//Statements Here
}
}
Run Code Online (Sandbox Code Playgroud)
Pau*_*ier 10
在C#中,没有纯(裸)函数; 所有可执行代码都存在于类的上下文中.类的可执行成员(函数)称为方法.这就是语言中定义事物的方式.
这对于面向对象编程来说是非常标准的; 你可能想要更多地研究它.
| 归档时间: |
|
| 查看次数: |
452 次 |
| 最近记录: |