C/C++
MIPS71
这个作者很懒,什么都没留下…
展开
-
C++重载下标操作符const & nonconst 成员函数使用比较
这两天在自己尝试写向量和矩阵运算的类,之前一直用C,对C++的类特性不是很熟,在重载操作符时遇到了一些问题。这里就说说在重载下标操作符时,对const对象和非const对象使用下标我的一些学习经历。 手头看的是中文版C++ Primer 4th edition, P443页上写着:类定义下标操作符时,一般需要定义两个版本:一个为非const成员并返回引用,另一个为co原创 2013-06-24 18:00:58 · 1366 阅读 · 0 评论 -
error LNK2005 多次定义inline解决办法
在vs2008下编译自己写的三维向量类头文件vec3f.h,有如下重载操作符成员:#ifndef _VECTOR3F_#define _VECTOR3F_class vec3f{public: ... vec3f& operator = (const vec3f &v);...};vec3f& vec3f::operator = (const vec原创 2013-06-25 16:56:12 · 749 阅读 · 0 评论 -
C++学习——Overriding(1)
#include using namespace std;struct Base{ virtual string get_num(string) const {return "Base";}};struct Derived: Base{ string get_num(string) { return "Derived";} // does原创 2014-02-24 21:34:16 · 733 阅读 · 0 评论 -
C++ int to string
C++中int到string1. int sprintf( char *buffer, const char *format [, argument] ... ); 例如: int ss; char temp[64]; string str; ss = 1000; sprintf(temp, "%d转载 2014-04-21 20:48:30 · 588 阅读 · 0 评论 -
C++类成员函数中static变量小测试
#include using namespace std;class Test{public: int getStaticVariable() // member function belong to class not instances { static int i = 0; // belong to function, so static t原创 2014-04-24 15:28:42 · 623 阅读 · 0 评论 -
C++简单Random类
#include #include class Random{public: static void InitSeed() { srand(time(0)); } static float Value() { return (float)rand() / RAND_MAX; } static int Range(int min, int max) // [原创 2014-04-21 20:52:01 · 4367 阅读 · 0 评论 -
配置OpenGL glew库
配置好freeglut之后,我们开始给OpenGL环境配置glew库。下载glew http://glew.sourceforge.net/这次我们下载Binar文件,下载后解压。这一步没什么难点,在bin,lib,include里找到我们需要的文件后,参考freeglut拷贝到对应目录就好。注意32位和64位的问题,我VS用的32位Release,所以我选用32位的原创 2017-03-30 23:28:36 · 2521 阅读 · 0 评论 -
Windows 10 配置OpenGL ES 3.0 环境
1.下载Mali OpenGL ES Emulatorhttps://developer.arm.com/products/software-development-tools/graphics-development-tools/opengl-es-emulator/downloads注意下载的版本,我用的VS2010 win32,所以这里下载32位版有exe和zip两个版本,这里使用z原创 2017-11-02 19:08:52 · 4828 阅读 · 0 评论