Ray's playground

 

2011年4月5日

Item 41: Understand implicit interfaces and compile-time polymorphism(Effective C++)

摘要: Both classes and templates support interfaces and polymorphism. For classes, interfaces are explicit and centered on function signatures. Polymorphism occurs at runtime through virtual functions. For template parameters, interfaces are implicit and based on valid expressions. Polymorphism occurs du. 阅读全文

posted @ 2011-04-05 21:41 Ray Z 阅读(228) 评论(0) 推荐(0) 编辑

Item 40: Use multiple inheritance judiciously(Effective C++)

摘要: Multiple inheritance is more complex than single inheritance. It can lead to new ambiguity issues and to the need for virtual inheritance. Virtual inheritance imposes costs in size, speed, and complexity of initialization and assignment. It's most practical when virtual base classes have no data 阅读全文

posted @ 2011-04-05 10:36 Ray Z 阅读(167) 评论(0) 推荐(0) 编辑

Script Execution Context(Chapter 3 of Programming Python)

摘要: 1importsys23classOutput:4def__init__(self):5self.text=''6defwrite(self,string):7self.text+=string8defwritelines(self,lines):9forlineinlines:10self.write(line)1112classInput:13def__init__(self,input=''):14self.text=input15defread(self,size=None):16ifsize==None:17res,self.text=self.tex 阅读全文

posted @ 2011-04-05 09:56 Ray Z 阅读(275) 评论(0) 推荐(0) 编辑

导航