实验2-Gettingclassy.docVIP

  • 160
  • 0
  • 约1.99万字
  • 约 14页
  • 2017-03-09 发布于重庆
  • 举报
实验2-Gettingclassy

LABORATORY 2 实验2 Getting classy 初窥C++类 姓名: _ ___ 学号: ___________ 班级: Objective 实验目的 Objects are the basic unit of programming in object-oriented languages like C++. The C++ construct for defining new types of objects is the class. A class is the “blueprint” from which an object can be created. This laboratory examines the basic mechanisms of class types by inspecting several different classes. 对象是如C++等面向对象的语言中最基本的程序单位。C++的构造中,定义新的对象类型就是类。类就是用来创建对象的“蓝图”。本次实验的目的就是通过观察几个不同的类来学习类的基本机制。 Key Concepts 相关概念 _ class construct (类的构造) _ Access specification(访问限定) _ Information hiding (信息隐藏) _ Constructors (构造器) _ Encapsulation (封装) _ Inspectors () _ Data members () _ () _ Facilitators () GETTING STARTED Using the procedures in the introductory laboratory handout, create the working directory \cpplab on the appropriate disk drive and obtain a copy of self-extracting archive lab02.exe. The copy should be placed in the cpplab directory. Execute the copy to extract the files necessary for this laboratory. 采用实验说明手册中的步骤,在硬盘上合适的位置创建工作目录\cpplab,获取自解压打包文件lab02.exe的一个拷贝,并将其放在cpplab目录中解包得到实验所需的源文件。 Many of the activities that are performed in the laboratory can be done in groups but you should work the exercises yourself. 实验中的许多活动都能在小组中完成,但你应该独立完成这个实验。 CLASSES 类 Objects are the fundamental units of programming in object-oriented languages such as C++. Objects are models of information and are implemented as software packages that contain or encapsulate both attributes and behavior. A data abstraction is a representation of information and the operations to be performed on it. 对象是比如C++这样的面向对象语言中的基础编程单元。对象是信息模型,并被实现为包含或封装了属性和行为的软件模块。数据抽象包括信息的表达和作用在信息上的操作的描述。 A fundamental type is a type that the programming language provides. For example, in C++, the type int and the operations on it are part of the language definition. That is, all C++ compilers must provide int objects. In addition to the fundamental types, C++ provides several mechanisms to define other types. These other typ

文档评论(0)

1亿VIP精品文档

相关文档