
学习c++vc6中的问题
zzhclc
这个作者很懒,什么都没留下…
展开
-
4.7.2多态案例——计算机类
#include<iostream>using namespace std;#include<string>//分别利用普通写法、多态技术实现计算器//普通写法class Calculator{public: int Getresult(string oper) { if(oper=="+") { return m_Num1+m_Num2; } else if(o...原创 2021-09-09 21:35:50 · 150 阅读 · 0 评论 -
4.6.6继承同名静态成员处理方式
#include<iostream>using namespace std;class Base{public: static int m_A; static void func() { cout << "Base -static void func()" << endl; } static void func(int a) { cout << "Base -static...原创 2021-09-08 22:50:23 · 98 阅读 · 0 评论 -
4.6.3继承中的对象模型
#include<iostream>using namespace std;//继承中的对象模型class Base{public: int m_A;protected: int m_B;private: int m_C;};class son : public Base{public: int m_D;};void test01(){ //16 //父类中所有属性都会被子类继承下去 //父类中私有成员属性...原创 2021-09-07 23:38:44 · 90 阅读 · 0 评论 -
4.6.2继承方式
#include<iostream>using namespace std;//公共继承class Base1{public: int m_A;protected: int m_B;private: int m_C;};class son1 : public Base1{public://以下是son1的公共部分 void func() { m_A=10;//父类中的公共权限成员,到子类中依然是公共权限。 ...原创 2021-09-07 23:07:06 · 88 阅读 · 0 评论 -
vc6,通过结构体创建变量,non-aggregates cannot be initialized with initializer list的报错
#include<iostream>using namespace std;#include<string>//1.创建学生数据类型:学生(姓名,年龄,分数)struct student{ //成员列表 //姓名 string name; //年龄 int age; //分数 int score;};int main(){//2.通过学生模型创建具体学生//2.1.struct student s1...原创 2021-08-25 22:44:30 · 408 阅读 · 0 评论 -
vc6,sizeof(__int64)无法显示出8
#include<iostream>using namespace std;int main(){ //整形4类型1.短整型2.整形3.长整型4.长长整型 //sizeof求各个数据类型所占据的内存大小,而不用特别记忆。 //sizeof(数据类型/变量) //sizeof(short)或者sizeof(num1) short num1=10; cout<<"short占用的内存空间="<<sizeof(...原创 2021-08-20 23:18:43 · 192 阅读 · 0 评论