![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++
Fatestay_DC
这个作者很懒,什么都没留下…
展开
-
矩阵-旋转
class Vector3;class Matrix3X3 {public: float m11, m12, m13; float m21, m22, m23; float m31, m32, m33; void SetRotate(int x, float theta);};Matrix3X3 operator*(const Matrix3X3 &m1, const Matrix3X3 &m2);Vector3 operator*(const Vector3 &.原创 2020-06-03 16:46:12 · 241 阅读 · 0 评论 -
矩阵乘法
class Vector3;class Matrix3X3 {public: float m11, m12, m13; float m21, m22, m23; float m31, m32, m33;};Matrix3X3 operator*(const Matrix3X3 &m1, const Matrix3X3 &m2);Vector3 operator*(const Vector3 &v, const Matrix3X3 &m);#inc.原创 2020-06-03 10:29:32 · 144 阅读 · 0 评论 -
C++函数指针
函数指针就是一个指针指向函数而不是对象,和其他指针一样,函数指针指向一个特殊的类型,一个函数的类型取决于返回值以及它的参数,函数名字只是类型的一部分如下例子: bool lengthCompare(const string &,const string &); 声明上面函数的指针形式如下: bool (*fp) (const string &原创 2015-07-29 08:24:44 · 429 阅读 · 0 评论 -
C++内联函数
SizeType由string类类型和vector类类型定义的类型,用以保存任意string对象或vector对象的长度,标准库类型将size_type定义为unsigned类型class Screen{public: Screen(void); ~Screen(void); typedef string::size_type pos; Screen(pos ht,p原创 2015-08-02 12:46:31 · 388 阅读 · 0 评论 -
C++类基础代码
include using namespace std;pragma onceclass Sale_items { friend Sale_items add(const Sale_items&,const Sale_items&); friend ostream &print(ostream&,const Sale_items&); friend istream &原创 2015-08-02 11:14:31 · 612 阅读 · 0 评论 -
C++(简单工厂)
// ConsoleApplication18.cpp : Defines the entry point for the console application.//#include "stdafx.h"typedef enum Type{ TypeA, TypeB, TypeC,} ProductType;class Product{public: vo原创 2015-12-18 08:27:54 · 634 阅读 · 0 评论 -
工厂方法
class Product{public: virtual void Show()=0;};class ProductA:public Product{public: void Show() { cout<<"SHowA"<<endl; }};class ProductB:public Product{public: void原创 2015-12-21 08:30:54 · 481 阅读 · 0 评论 -
备忘录模式
// ConsoleApplication19.cpp : Defines the entry point for the console application.//#include "stdafx.h"//C++后面使用的类要先声明?/*负责存储GameRole对象的内部状态,并可防止GameRole以外的其他对象访问备忘录Memento。备忘录有两个接口,Caretaker只能看见备忘录的原创 2015-12-21 13:05:07 · 487 阅读 · 0 评论 -
命令模式
// ConsoleApplication19.cpp : Defines the entry point for the console application.//#include "stdafx.h"/*是一个抽象类,类中对需要执行的命令进行声明,一般来说要对外公布一个execute方法用来执行命令*/class Command{public: virtual void原创 2015-12-23 08:33:08 · 371 阅读 · 0 评论