Cpp9 模板
模板下面是一个针对int的冒泡排序// _20180301.cpp : Defines the entry point for the console application.//#include "stdafx.h"void Sort(int* arr,int nLength)
模板下面是一个针对int的冒泡排序// _20180301.cpp : Defines the entry point for the console application.//#include "stdafx.h"void Sort(int* arr,int nLength)
深浅拷贝相同类型间可以直接拷贝// _20180212.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include#includeclass A{private:
多态的实现原理#include "stdafx.h"#include#includeclass A{public: int x; virtual void Test() { printf("A \n"); }protect
继承子类从父类继承成员变量子类从父类继承成员函数#include "stdafx.h"class Person{public: int Age; int Sex; void Word() { printf("Person:Work&
我们可以在什么地方创建对象?全局变量区Person p;栈void Max(){Person p;}堆 new 和 delete//在堆中创建对象:Person* p = new Person();//释放对象占用的内存delete p;在堆中创建对象: new``delete在C语言中我们使用ma
好的编程习惯 -定义和实现分开代码会有更好的可读性但不是必须的在头文件中只留下声明代码Test.hstruct sclass{ int x; int y; int Bigger(int x,int y); int Max(int x,int y,int z);};Test.c
什么是继承struct Person { int age; int sex; };struct Teacher { int age; int sex; int level; int classId; };struct Teacher:Person { int level;
什么是构造函数#include "stdafx.h"#includestruct Sclass { int a; int b; int c; int d; Sclass()//构造函数 { printf("观察这个函数
什么是预处理预处理一般是指在程序源代码被转换为二进制代码之前,由预处理器对程序源代码文本进行处理,处理后的结果再由编译器进一步编译。预处理功能主要包括宏定义,文件包含,条件编译三部分宏定义简单宏: #define 标识符 字符序列#define FALSE 0#define NAME "L
封装C语言和C++语言的区别C是对C的补充扩展,C原有的语法C都支持,并在此基础上扩展了一些新的语法:继承、封装、多态、模板等等结构体可以作为参数传递吗struct Student{ int a; int b; int c; int d;}//分析这个函数是如何传递参数的in