一个对象可以被认为是一个变量吗? [英] Can an object be considered as a variable?

查看:118
本文介绍了一个对象可以被认为是一个变量吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有困难保持分类的类,对象,变量和数据类型。



一个类可以被认为是一个数据类型?


可以将一个对象视为一个变量吗?



>解决方案

这些术语有两种不同的用法:




  • >


    • 类:具有方法和字段的抽象数据类型。

    • 对象:类的实例

    • 变量:某些存储器的语言级别名称(即:由程序员指定的名称)。

    • 数据类型:键入一个变量
    • C / C ++标准使用(来自C标准,不是面向对象的语言:




      • 对象:某些存储空间,无论是否有名称。

      • 类类型的对象:数据类型为class(= struct)的某些存储。



    I'm having some trouble keeping apart the terms class, object, variable and datatype.

    can a class be considered as a datatype? can an object be considered as a variable?

    Also, what's the technical difference?

    解决方案

    There are two different uses of these terms:

    • Casual use:

      • Class: Abstract data type with methods and fields.
      • Object: Instance of a class.
      • Variable: Language-level name (i.e: name given by a programmer) for some piece of storage.
      • Datatype: Type that a variable (or some unnamed piece of storage) can have.
    • C/C++ standard use (comes from the C standard, which isn't an Object-Oriented Language:

      • Object: Some piece of storage, whether it has a name or not.
      • Object of Class Type: Some piece of storage whose datatype is class(=struct).

    这篇关于一个对象可以被认为是一个变量吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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