深浅拷贝 相同类型间可以直接拷贝
// _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; …
什么是继承 struct Person { int age; int sex; }; struct Teacher { int age; int sex; int level; int classId; }; struct Teacher:Person { int level; int classId; }; 总结:
1、什么是继承?
继承就是数据的复制 …
封装 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); …