C#中的对象和类之间有什么区别? [英] What is the difference between objects and classes in C#?

查看:200
本文介绍了C#中的对象和类之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
对象与实例之间的差异

Possible Duplicate:
Difference between object and instance

我有几个问题:

  1. 每个类的实例(抽象类除外)都是一个对象?
  2. 不能实例化抽象类,因此它们不是对象吗?

有人能帮助我更好地理解与C#相关的上述概念吗?

Could anyone help me better understand the above concepts as they relate to C#?

推荐答案

  1. 对象是类的实例.

  1. An object is an instance of a class.

类是对象的定义.直到实例化它才真正成为对象.由于无法实例化抽象类,因此无法创建该类型的对象.为了创建对象,需要定义一个子类.

A class is the definition of an object. It does not actually become an object until it is instantiated. Since an abstract class can't be instantiated, no object of that type can created. A sub class would need to be defined in order for an object to created.

这篇关于C#中的对象和类之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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