2013年7月29日

关于转换

摘要: class MyDaugter: public MyBase{ public : MyDaugter(string name2); private: string name2;}; string dtname="xiaofang"; MyDaugter dt=dtname;可以直接使用赋值运算符,那么两个参数呢,不可以!!! 阅读全文

posted @ 2013-07-29 17:00 shoutcharter 阅读(171) 评论(0) 推荐(0) 编辑

隐藏

摘要: void MyBase::SetName(int i,int j){ostringstream ost; ost << i; name=ost.str(); cout<<i<<"*"<<j<<"*2"<<endl;}void MySun::SetName(int i,int j){ SetName(i,j); ostringstream ost; ost << i; name=ost.str(); cout<<i<<"*"< 阅读全文

posted @ 2013-07-29 15:20 shoutcharter 阅读(104) 评论(0) 推荐(0) 编辑

setf

摘要: independent flagsboolalpharead/write bool elements as alphabetic strings (true and false).showbasewrite integral values preceded by their corresponding numeric base prefix.showpointwrite floating-point values including always the decimal point.showposwrite non-negative numerical values preceded by a 阅读全文

posted @ 2013-07-29 13:01 shoutcharter 阅读(159) 评论(0) 推荐(0) 编辑

关于里氏替换原则

摘要: you can not rewrite the function ,which have beenrealized by base class! 阅读全文

posted @ 2013-07-29 10:49 shoutcharter 阅读(119) 评论(0) 推荐(0) 编辑

关于抽象类

摘要: 抽象类就是强制实现纯虚函数的类。不能被实例化。这样就可以保证里氏替换原则的实现:强制实现纯虚函数,子类就可以完全替换父类,因为父类只有名字,没有动作,可替换性就很大。 阅读全文

posted @ 2013-07-29 10:47 shoutcharter 阅读(103) 评论(0) 推荐(0) 编辑

导航