- 1
- 0
- 约5.03千字
- 约 9页
- 2023-02-02 发布于安徽
- 举报
-
. z.
面向对象的程序设计
实验报告
课程名称:
面向对象的程序设计
:
实验名称:
静态成员和友元
**:
任课教师:
专业:
软件工程
指导教师:
班级:
15-软件一班
一、实验目的
1.理解静态成员〔静态数据成员、静态成员函数〕的作用与使用;
2.理解友元〔友元函数、友元类〕的作用于使用。
二、实验环境
编译器:Visual C++ 6.0.
操作系统:Windows 7旗舰版
三、实验容
二、实验容
2.1练习〔一〕:
1.理解下面的程序,并在VC++6.0下运行查看结果,答复程序后面的问题。
#include iostream.h
#include string.h
class CStudent
{
public:
CStudent(char *n, int a);
~CStudent();
static void SetAge(int age);
private:
char *name;
int age;
static int nTotalObj;
};
int CStudent::nTotalObj = 0;
CStudent::CStudent(char *n, int a)
:
原创力文档

文档评论(0)