扫码在手机阅读
手机阅读《大话设计模式》
大话设计模式

第3章

*/

publicclassBlahextendsSomeClass{

/*Aclassimplementationmentcangohere.*/

小A:“师兄你这是考我么?”

大B:“啥啊?我这是想看你在学校是不是真学到了东西。”

小A:“得得得,那我就说说吧!设计模式是一套被反复使用、多数人知晓的、经过分类编目的、代码设计经验的总结。使用设计模式是为了可重用代码、让代码更容易被他人理解、保证代码可靠性。设计模式于己于他人于系统都是多赢的,设计模式使代码编制真正工程化,设计模式是软件工程的基石,如同大厦的一块块砖石一样。”

*/

privatestaticObjectclassVar2;

/**instanceVar1documentationment*/

publicObjectinstanceVar1;

/**instanceVar2documentationment*/

protectedintinstanceVar2;

/**instanceVar3documentationment*/

privateObjectinstanceVar3;

/**

publicclassBlahextendsSomeClass{

/*Aclassimplementationmentcangohere.*/

*classVar2documentationmentthathappenstobe

*morethanonelinelong

*/

privatestaticObjectclassVar2;

/**instanceVar1documentationment*/

publicObjectinstanceVar1;

/**instanceVar2documentationment*/

protectedintinstanceVar2;

/**instanceVar3documentationment*/

privateObjectinstanceVar3;

/**

*……constructorBlahdocumentationment……

*/

publicBlah{

//……implementationgoeshere……

/**

*……methoddoSomethingdocumentationment……

*/

publicvoiddoSomething{

//……implementationgoeshere……

/**

*……methoddoSomethingElsedocumentationment……

*amsomeParamdescription

*/

publicvoiddoSomethingElse(ObjectsomeParam){

//……implementationgoeshere……

大B:“我再考考你,用C++、Java、C#www.youxs.org。”

小A不到几分钟就给大B一个程序。

*Classdescriptiongoeshere.

*horFirstnameLastname

*accordancewiththetermsofthelicenseagreementyouenteredinto

这天大B问小A:“怎样设计可复用的面向对象软件?”

/*

*(#)/03/18

*ThissoftwareistheconfidentialandproprietaryinformationofSun

*withSun.

*/

/**

*901SanAntonioRoad,PaloAlto,California,94303,www.youxs.org.

*Allrightsreserved.

*classVar2documentationmentthathappenstobe

*morethanonelinelong

*Microsystems,Inc.(“ConfidentialInformation”).Youshallnot

*disclosesuchConfidentialInformationandshalluseitonlyin

*Copyright(c)1994-1999SunMicrosystems,Inc.

  • 加入收藏
  • 目录
  • A+
  • A-