2017年3月28日
摘要: #include<iostream>using namespace std;int main(){int *pr;const int *prr;pr=prr;return 0;}编译时出错:C:\Users\Administrator\c++\Cpp9.cpp(6) : error C2440: ' 阅读全文
posted @ 2017-03-28 22:48 加油!!! 阅读(3300) 评论(0) 推荐(0)
摘要: int a;int * const p = &a; //指针常量,*p可以修改*p = 8;(OK) p不可以修改 p++(ERROR)int a,b;const int *p = &a或const int*p;//常量指针 *p不可修改 *p = 8;(ERROR) p 可以修改 p = &b ( 阅读全文
posted @ 2017-03-28 22:35 加油!!! 阅读(221) 评论(0) 推荐(0)
摘要: 定义:既可以是不属于任何类的非成员函数又可以是另一个类的成员函数 意义1:友元是一扇通向私有(保护)类的大门 形式:声明函数时前加friend(此声明可以放在公有部分和私有部分和保护部分) 将非成员函数定义为友元函数: 注:a、友元函数的定义既可以在类内,也可以在类外 b、友元函数中使用私有成员:对 阅读全文
posted @ 2017-03-28 13:18 加油!!! 阅读(134) 评论(0) 推荐(0)