
C/C++
DaveeChen
呵呵
展开
-
C++的常量const基本用法
#include using namespace std;class Const { const int i; int j;public: Const(int ci); void test(); const int* constTest(); int* constTest2() const;};Const::Const(int ci):i(ci) { j = 18;}原创 2014-02-21 22:53:29 · 1002 阅读 · 0 评论 -
Android通过NDK获取Keystore签名值
防止别人反编译自已的游戏再修改然后发布,我们可以用在so文件中用Keystore签名值来加密一些参数。这里只提供NDK获取Keystore签名值代码package com.boyaa.ndk;import android.content.Context;public class RegionGames { static { try { System.loadLi原创 2014-03-20 19:02:43 · 11418 阅读 · 2 评论 -
C语言中的函数指针与指针函数
函数是任何一门语言中必不可少的部分,正是由这些函数组成了程序。首先谈一下C语言中的函数指针与指针函数,再了解一下函数参数传递的相关原理。1.函数指针与指针函数(1) 函数指针 即指向这个函数的指针,定义为 数据类型 (*fun)(参数列表) ,()的优先级比*高,所以*fun加括号。如 void (*fun)(int*,int*);(2)指针函数 即返回值是指针的函数,定义为 数据类型转载 2014-05-22 23:38:03 · 1037 阅读 · 0 评论 -
C/C++读写文件
#include #include using namespace std;void c_read_file();void c_write_file();void cpp_read_and_write_file();void main(){ c_read_file(); c_write_file(); cpp_read_and_write_file(); getcha原创 2014-05-23 23:30:04 · 1005 阅读 · 0 评论 -
C++模板
模板类似于Java中的it#include using namespace std;#define LOGE(e) cout << #e << "=" << e << endl;//类模板template class Stack{ T data[N]; size_t cur_pos;public: Stack() { cur_pos = 0; } void p原创 2014-05-25 23:17:28 · 783 阅读 · 0 评论 -
指向指针(函数)的指针
#include using namespace std;#define LOGE(e) cout << #e << "=" << e << endl;void pointer(int* const p) { (*p)++; //*p++; //error cout << "pointer:" << *p << endl;}void reference(int& r) {原创 2014-05-25 23:25:07 · 831 阅读 · 0 评论 -
虚函数——virtual
virtual关键字用来#include using namespace std;#define LOG(x) cout << x << endl;class Base { int i;public: Base(int j):i(j) { LOG("Base"); } ~Base(void) { LOG("~Base"); } int getI()原创 2014-05-26 00:10:41 · 977 阅读 · 0 评论