CSCAPrep
Reviewed CSCA STEM Chinese question · Standard

在编程中,_是一种将数据结构和操作封装在一起,并通过公开接口访问的编程思想。

  1. 继承
  2. 多态
  3. 封装
  4. 抽象
Show the answer and explanation

Correct answer

C. 封装

Principle or equation

面向对象编程的三大特性:封装、继承、多态。封装将数据和操作绑定,隐藏内部实现,通过接口访问。

Why this answer is correct

封装是指将数据(属性)和操作(方法)组合在一个对象中,并对外提供公开接口,隐藏内部细节。因此选择“封装”。

Example

定义一个类 Student,包含私有属性 name 和公有方法 getName(),外部只能通过 getName() 获取姓名,这就是封装。

This published item includes a stored explanation and passed the platform’s publication workflow. It is independent preparation material, not a claim of an official or recalled examination question.

Related practice questions