年轻人不通人情世故的C++短处中

因为韩幌从这位年轻人不通人情世故的C++短处中,看到了他铁面无私、刚直不阿的长处,于是任命他为监库门。年轻人上任之后,恪尽职守,库亏之事极少发生。清代有位将军叫杨时斋,他认为军营中没有无用之人。

修改时如果遵循单一职责原则,需要将animal类细分为陆生动物类terrestrial,水生动物aquatic,代码如下:class terrestrial{public void breathe(string animal){system out println(animal+"呼吸空气");}}class aquatic{public void breathe(string animal){system out println(animal+"呼吸水");}}public class client{public static void main(string[] args){terrestrial terrestrial = new terrestrial();terrestrial breathe("牛");terrestrial breathe("羊");terrestrial breathe("猪");aquatic aquatic = new aquatic();aquatic breathe("鱼");}}运行结果:牛呼吸空气羊呼吸空气猪呼吸空气鱼呼吸水我们会发现如果这样修改花销是很大的C++,除了将原来的类分解之外,还需要修改客户端。

4 数据提交在可靠的C++情况下,多考虑异步模式或多线程。对数据库的提交,web服务的访问都可以使用异步模型,当然是在可靠的情况下。页面的ajax自然也是异步的一种方式,另外js文件的加载也可以异步的方式。

你可能感兴趣的:(c++,string,class,system,web服务,多线程)