正确描述“类”[关闭]

问题描述 投票:-3回答:1
public class Program
{
  static void Main(string[] args)
  {
    Test test = new Test();
    Console.WriteLine(test.GetType()); // -> it´s Test, of course
    int a = 5;
    Console.ReadLine();
  }
}

public class Test
{
  public string Name;
}

在上面的例子中,“test”的类型是Test,对吧? 在这种情况下,“a”的类型是int,命名为原始数据类型,public是访问修饰符

所以现在我的问题是,什么是课程呢?关键字?原始数据类型?既不也不?

请不要解释我,一个班级正在做什么或者班级或对象之间有什么区别,我知道一个班级就像一个建设计划。

c# class typeof
1个回答
0
投票

Class是一个关键字,表示C#编译器正在声明一个类。见https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/

© www.soinside.com 2019 - 2024. All rights reserved.