摘要: // 构造函数与析构函数2.cpp : 定义控制台应用程序的入口点。//学习动态内存单元的申请 #include "stdafx.h"#includeusing namespace std;class Student{public: Student(); Student(int pid, char*pname, float s); void modify(float s); ... 阅读全文
posted @ 2016-05-24 03:32 01Turing 阅读(94) 评论(0) 推荐(0) 编辑
摘要: // 构造函数与析构函数.cpp : 定义控制台应用程序的入口点。//要学习的两点://要想表现出析构函数,必须在对象外面加大括号!!// while (cin.get() != '\n') num++;#include "stdafx.h"#includeusing namespace std;class Count{public: Count(); ~Count(); ... 阅读全文
posted @ 2016-05-24 03:09 01Turing 阅读(151) 评论(0) 推荐(0) 编辑
摘要: //构造函数含有含默认值的参数 #include "stdafx.h"#includeusing namespace std;class Box{public: Box(int w = 10, int h = 10, int len = 10); int volume();private: int height; int width; int length;}; Bo... 阅读全文
posted @ 2016-05-24 02:54 01Turing 阅读(525) 评论(0) 推荐(0) 编辑