JShell07's Blog

  • Home

  • Tags48

  • Categories18

  • Archives76

  • Search

钱:7步创造终生收入

Posted on 2019-05-12 | Edited on 2020-04-26 | In bookmarks

托尼·罗宾斯

Read more »

财务自由之路

Posted on 2019-04-24 | Edited on 2020-04-26 | In bookmarks

博多·舍费尔

Read more »

arm gicv2

Posted on 2019-04-20 | Edited on 2020-04-26 | In arm

GICv2

Read more »

史蒂夫.乔布斯传

Posted on 2019-04-16 | Edited on 2020-04-26 | In bookmarks

他去印度追寻过佛,热衷于冥想;
他创立了苹果,Next,皮克斯公司;
他推出了iMac, iPod, iPhone, iPad,iCloud产品;
他创建了iTunes, Apple Stores。

史蒂夫·乔布斯传, 是史蒂夫·乔布斯唯一授权的官方传记。

Read more »

富甲美国:沃尔玛创始人山姆.沃尔顿自传

Posted on 2019-04-15 | Edited on 2020-04-26 | In bookmarks

山姆·沃尔顿

Read more »

褚时健传

Posted on 2019-04-15 | Edited on 2020-04-26 | In bookmarks

褚时健(1928年1月23日-2019年3月5日),云南红塔集团有限公司和玉溪红塔烟草(集团)有限责任公司原董事长,褚橙创始人,先后经历两次成功的创业人生,被誉为中国烟草大王、中国橙王。

Read more »

快速阅读术

Posted on 2019-04-15 | Edited on 2020-04-28 | In bookmarks

快速阅读术

Read more »

Design_Pattern_IV

Posted on 2019-01-28 | Edited on 2020-04-28 | In bookmarks

1. 行为模式

1.1. 模板模式(Template)

在模板模式(Template Pattern)中,一个抽象类公开定义了执行它的方法的方式/模板。它的子类可以按需要重写方法实现,但调用将以抽象类中定义的方式进行。
将通用算法(逻辑)封装起来,而将算法细节让子类实现(多态)。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
class AbstractClass
{
public:
virtual ~AbstractClass();
void TemplatMethod();
protected:
virtual void Operation1() = 0;
virtual void Operation2() = 0;
}

class ConcreteClass1: public AbstractClass
{
public:
ConcreteClass1();
~ConcreteClass1();
protected:
void Operation1() {cout<<"ConcreteClass1 Operation1"<<endl;}
void Operation2(){cout<<"ConcreteClass1 Operation1"<<endl;}
}

class ConcreteClass2: public AbstractClass
{
public:
ConcreteClass2();
~ConcreteClass2();
protected:
void Operation1() {cout<<"ConcreteClass2 Operation1"<<endl;}
void Operation2(){cout<<"ConcreteClass2 Operation1"<<endl;}
}

void main()
{
AbstractClass * c1 = new ConcreteClass1();
AbstractClass * c2 = new ConcreteClass2();

c1->TemplateMethod();
c2->TemplateMethod();

delete c1;
delete c2;
}
Read more »

Design_Pattern_III

Posted on 2019-01-28 | Edited on 2020-04-28 | In bookmarks

1.结构型模式

1.1. 桥接模式(Bridge)

桥接(Bridge)是用于把抽象化与实现化解耦,使得二者可以独立变化。这种类型的设计模式属于结构型模式,它通过提供抽象化和实现化之间的桥接结构,来实现二者的解耦。
其实围绕的本质还是面向对象的原则:松耦合(Compling), 高内聚(Cohesion)。

FixMe image of Bridge

Read more »

Design_Pattern_II

Posted on 2019-01-28 | Edited on 2020-04-28 | In bookmarks

1. 创建模式(Creational Patterns)

1.1. 工厂模式(Factory)

目的:定义一个创建对象的接口,让其子类自己决定实例化哪一个工厂类,工厂模式使其创建过程延迟到子类进行。
优点: 扩展性高,并且屏蔽具体的实现。
缺点: 每增加一个产品时,都需要实现具体类和对象实现工厂。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

class Shape
{
public:
virtual void draw() {};
};

class Circle: public Shape
{
public:
void draw() { /* ... */ };
};

class Square: public Shape
{
public:
void draw() { /* ... */ };
};

class ShapeFactory
{
public:
class Shape * GetShape(string type) {
if(type.compare("CIRCLE") == 0)
return new Circle();
else if(type.compare("SQUARE") == 0)
return new Square();
else
return null;
}
}

void main()
{
class ShapeFactory shapeFactory = new ShapeFactory();

class Shape *shape1, shape2;

shape1 = shapeFactory.GetShape("CIRCLE");
shape1->draw();

shape2 = shapeFactory.GetShape("SQUARE");
shape2->draw();

delete shape1;
delete shape2;
}

Read more »
1…456…8
JShell07

JShell07

76 posts
18 categories
48 tags
GitHub E-Mail
© 2017 — 2020 JShell07
Powered by Hexo v3.7.1
|
Theme — NexT.Gemini v6.3.0
0%