摘要: c++面向对象类继承class Student:public Person{float score;}class : 派生类和基类的构造函数。派生类 覆盖 基类的方法。 1 // 2 // Person.h 3 // ArrayTest 4 // 5 // Created by 张学院 on 14-1-8. 6 // Copyright (c) 2014年 com.mix. All rights reserved. 7 // 8 9 //防止重复引用10 #ifndef __ArrayTest__Person__11 #define __ArrayTest__Person__12... 阅读全文
posted @ 2014-01-09 16:29 aosting 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 拷贝构造函数一个类对象向该类的另外一个对象作拷贝是通过依次拷贝每个非静态数据成员来实现的。只有在创建新的对象的时候才会调用拷贝构造函数设计者也可以通过提供特殊的拷贝构造函数来改变缺省的行为Person(const Person & person);依次Person.h,Person.cpp,main.cpp 1 // 2 // Person.h 3 // ArrayTest 4 // 5 // Created by 张学院 on 14-1-8. 6 // Copyright (c) 2014年 com.mix. All rights reserved. 7 // 8 9 //防止重复. 阅读全文
posted @ 2014-01-09 15:36 aosting 阅读(147) 评论(0) 推荐(0) 编辑