![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++基础
机械吴哥123
我很懒,不想写简介
展开
-
【c++基础】菱形继承问题
先上代码: #include <iostream> using namespace std; //动物类 class animmal { public: int age; double price; string name; }; //羊类 class yang : virtual public animmal{ public: int weight; }; //驼类 class tuo : virtual public animmal { public: int weight;原创 2020-12-08 17:47:18 · 163 阅读 · 0 评论 -
【c++】指针常量与常量指针
提示:仔细看到结尾,必有收获 文章目录前言一、情况1:二、情况2:情况3:总结 前言 一、情况1: 1、首先定义一个变量,不赋初值。 Const int * ptr = &a; const -常量,int*- 指针,因此连起来:常量指针。所以指针ptr指向如下所示: cout << ptr << endl; 输出:0034FCC8 cout << ptr << endl; 输出:-66666666* *ptr = 2;//该语句非法,因为该原创 2020-12-02 22:52:25 · 217 阅读 · 0 评论