深浅拷贝 相同类型间可以直接拷贝
// _20180212.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include #include class A { private: int* a; public: A() { a = new …
继承 子类从父类继承成员变量 子类从父类继承成员函数 #include "stdafx.h" class Person { public: int Age; int Sex; void Word() { printf("Person:Work"); } }; class Teacher:public Person { public: int Level; …
封装 C语言和C++语言的区别 C++是对C的补充扩展,C原有的语法C++都支持,并在此基础上扩展了一些新的语法:
继承、封装、多态、模板等等
结构体可以作为参数传递吗 struct Student { int a; int b; int c; int d; } //分析这个函数是如何传递参数的 int Plus(student s) { return …
“*”的几种用途 乘法运算符
int x = 1; int y = 2; int z = x * y;
定义新的类型
char x; char* x;
取值运算符
指针类型的变量 int* a =(int*)1; printf("%x \n",(a +1)); 10: int a =(int*)1; 00401028 mov dword ptr …
&符号是取地址符,任何变量都可以使用&来获取地址,但不能用在常量上
struct Point { int x; int y; }; char a; short b; int c; Point p; printf("%p %p %p %p \n",&a,&b,&c,&p); printf("%x %x %x %x \n",&a,&b,&c,&p); …
多维数组的定义 比如一个班有5个组,每个组有9个人
int arr[45] 或者 intarr[5*9] 或者 int arr[5][9]
比如一个县有5个学校,每个学校有3个年级,每个年级有4个班,每个班有5个组,每个组有9个人
int arr[53459] 或者int arr[5][3][4][5][9] int arr[5][3][4][5][9] , …