Skip to content

Classes & objects · ⁨类与对象⁩

English

A class is a blueprint

  • A class defines a new kind of thing — a user-defined type.
  • An object is one item made from that class.
  • One Dog class can make many dog objects, each with its own data.

中文

类是一张蓝图

  • 类(class)定义一种新的事物 —— 一个用户自定义类型。
  • 对象(object)是用这个类造出来的一个实例。
  • 一个 Dog 类可以造出许多狗对象,每个都有自己的数据。

Point 类是蓝图;p 和 q 是两个对象,各有自己的 x 和 y

Handout

Log in or create account · ⁨登录或创建账户⁩

IGCSE, A-Level · ⁨IGCSE、A-Level⁩ & AP · ⁨与 AP⁩