c++ 就业
文章平均质量分 67
user_define_race
这个作者很懒,什么都没留下…
展开
-
day2 内存模型 二级指针
#include #include #include //二级指针第一种内存模型void main01(){ char * ArrayStr[]={"cc","aa","bb","111"}; char *tmp=NULL; int i=0; int j=0; for(i=0;i<4;i++) { printf("%s \n",ArrayStr[i]); } for(原创 2015-01-22 23:49:20 · 360 阅读 · 0 评论 -
模版
c++ 如何支持模版的?原创 2015-06-03 23:53:21 · 341 阅读 · 0 评论 -
c++ 多态
#include using namespace std;//赋值兼容性原则(把子类对象赋给父类指针或引用)//函数重写 //这就是面向对象的新需求//如果传来子类对象,那么执行子类函数//多态 c++ 编译器提供的多态方案是虚函数class Parent{public: Parent(int a=0) { this->a=a; } virtual void pri原创 2015-05-30 19:04:56 · 454 阅读 · 0 评论 -
数组的操作符重载
#ifndef _ARRAY_H_#define _ARRAY_H_class Array{private: int mLength; int * mSpace;public: Array(int lenght); Array(const Array& obj); int getlength(); void setData(int index,int value); int原创 2015-05-28 22:31:06 · 296 阅读 · 0 评论 -
c++ 拷贝构造函数
#include using namespace std;class Location{private : int X; int Y;public: Location(int xx=0,int yy=0) { X=xx; Y=yy; cout<<"constructor "<<endl; } Location(const Location& p) { X=p.原创 2015-04-09 21:15:45 · 398 阅读 · 0 评论 -
c++操作符号重载
#include using namespace std;//运算符重载使得用户自定义的数据以一种更简洁的方式工作class Complex{private: int a; int b; friend Complex operator+(Complex &c1,Complex &c2); //前置++ friend Complex& operator++(Complex &原创 2015-04-14 20:24:45 · 505 阅读 · 0 评论 -
c++ new delete
#include using namespace std;void main1(){ //int *p=(int *)malloc(sizeof(int)); int *p1=new int; *p1=1; printf("%d\n",*p1); delete p1; system("pause");}void main2(){ //int *p=(int *)mallo原创 2015-04-12 16:34:10 · 293 阅读 · 0 评论 -
static 关键字
#include using namespace std;//用static 修饰变量void GetStatic(){ int a =10; static int b=10; //b只初始化一次 printf("a:%d b:%d\n",a,b); a++; b++;}//这个函数 只能在这个c中被使用static void myprint()原创 2015-04-12 16:37:03 · 381 阅读 · 0 评论 -
c++ 成员函数和全局函数的转换
#include using namespace std;class Test1{ public: Test1(int a=0,int b=0) { this->a=a; this->b=b; } //成员函数 Test1& t_add(Test1 &t2) { this->a=this->a + t2.a; this->b=this->b + t2原创 2015-04-12 22:28:40 · 1472 阅读 · 0 评论 -
结构体基础 数组 做函数参数
#include #include #include //1自己定义一个数据类型 数据类型的本质:是固定大小内存块的别名//2在.c / .cpp 注意结构体类型定义变量的时候,c和c++ 编译器的处理行为不一致//3 结构体类型typedef//4 结构变量内存4字节存放//类型可以重定义typedef struct Teacher{ char name[62];//6原创 2015-02-01 11:57:29 · 1368 阅读 · 0 评论 -
数组类型
#include "stdio.h"#include "stdlib.h"#include "string.h"void main22(){ //数组的初始化 // int i=0; int a[10]={1,2};//a 代表数组首元素的地址,不是数组的地址 //&a 表示整个数组的地址 &a a代表的数组类型不一样 //&a 代表数组类型 //a 数组首元素类型原创 2015-01-27 00:00:52 · 517 阅读 · 0 评论 -
c++ 接口api socket
#include "stdio.h"#include "stdlib.h"#include "string.h"#include "cltsockekt.h"//打桩 //1,客户端初始化环境int cltSocket(void **handle){ return 0; }// 2,客户端发报文int cltSocket_senddata(void *handle,unsi原创 2015-01-13 21:31:10 · 440 阅读 · 0 评论 -
智能指针
#define _CRT_SECURE_NO_WARNINGS #include #include using namespace std;class A{public: A(int a) { cout << "A(int)" << endl; this->a = a; } void func(){ cout << "a = " << a << endl;原创 2017-06-18 00:05:57 · 182 阅读 · 0 评论