tag 标签: base

相关博文
  • 热度 23
    2012-4-13 21:23
    1697 次阅读|
    0 个评论
      The is a relationship Derivation defines an "is a" or "is a kind of" relationship between the derived and base class. That is, a circle is a shape, a rectangle is a shape, and a triangle is a shape. This relationship is only in the direction of the arrows in the diagram—from derived to base, but not from base to derived or from derived to derived. For example, a shape is not necessarily a circle, and a circle is certainly not a rectangle. In C++, the is a relationship manifests itself as a built-in conversion from "pointer to derived class" into "pointer to base class". This lets you create a collection of assorted shapes as an array of pointer to shapes, and populate that array with pointers to circles, rectangles, and triangles. For example: shape *sc ; ~~~ sc = new circle (2); sc = new triangle (5, 6, asin(0.8)); sc = new rectangle (3, 4); sc = new circle (3); Here, the new-expression: new circle (2) creates a circle initialized with radius 2 and returns the address of that circle as a value of type "pointer to circle". The assignment: sc = new circle (2); assigns that "pointer to circle" to a "pointer to shape", but this is fine because a circle is a shape. Last month, I presented a function called largest which determines the shape with the largest area in a collection of shapes. Here is a version of that function, written in C++ to work with the hierarchy of shapes: shape const *largest(shape const *s -area(); if (area max) { max = area; p = s ; } } return p; } Here, s is a pointer to a shape in the collection. The expression s -area() is supposed to call the area function for each shape. Unfortunately, with the class definitions as is, it doesn't yet work correctly. Here's why... Static vs. dynamic binding Again, an assignment such as: sc = new circle (2); assigns a "pointer to circle" to a "pointer to shape". Such assignments make it harder to talk about the type of sc : it's declared to point to a shape, but it actually points to a circle. Later in the same program, another assignment such as: sc = new rectangle (3, 4); assigns a "pointer to rectangle" to a "pointer to shape". Pointer sc is still declared to point to a shape, but now it points to a rectangle. Here's some terminology that makes it easier to discuss such schizophrenic behaviour. The static type of an expression is its type based on the declared type of the operands in that expression. The compiler determines an expression's static type during compilation. That type doesn't change as long as the source program doesn't change. The dynamic type of an expression is the type of the object that the expression actually designates at some point during program execution. The dynamic type of an expression may change during execution. For example, the expression sc always has static type "pointer to shape". After the assignment: sc = new circle (2); the expression sc still has static type "pointer to shape", but now it has dynamic type "pointer to circle". After the assignment: sc = new rectangle (3, 4); the expression sc still has static type "pointer to shape", but now it has dynamic type "pointer to rectangle". Now, here's why the largest function doesn't yet work correctly. The expression s -area() is supposed to compute the area based on the dynamic type of s . That is, if s actually points to a circle, then s -area() should call the circle's area function. If s actually points to a rectangle, then s -area() should call the rectangle's area function. And so on. Unfortunately, it doesn't work that way, yet. By default, C++ uses static binding for member function calls. That is, s has static type "pointer to shape", so s -area() always calls the area function for the static type of *s , which is the base class shape. However, the largest function needs the call to use dynamic binding: s -area() should call the area function for the dynamic type of *s , be it circle, rectangle, triangle, or any type derived from shape. Virtual functions To get the area functions in all the shapes to bind dynamically, all you have to do is declare area as a virtual function in the base class: class shape { public: shape(); // constructor virtual double area() const; virtual double perimeter() const; ~~~ }; I want the perimeter function to be dynamically bound as well, so I declared it virtual, too. That's all I had to do. Now the largest function works just as it should. The "virtual" property is an inherited trait: a function in a derived class with the same name and parameter type(s) as a function in its base class is virtual by default. That is, in: class rectangle: public shape { public: rectangle(double h, double w); double area() const; ~~~ }; the area function is virtual, even though it doesn't say so explicitly. If you prefer to be explicit, you can write: class rectangle: public shape { public: rectangle(double h, double w); virtual double area() const; ~~~ }; and it behaves just the same. A lot more to come I'll have more to say in future columns about how virtual functions work and how you can emulate them in C.  
相关资源
  • 所需E币: 0
    时间: 2022-5-14 14:25
    大小: 1.13MB
    DesignIntelligentModelbaseOnlineTuningMethodologyforNonlinearSystem
  • 所需E币: 1
    时间: 2022-5-7 10:18
    大小: 466.38KB
    ASurveyofPIDControllerDesignBasedonGainandPhaseMargins
  • 所需E币: 0
    时间: 2022-5-5 16:43
    大小: 1.11MB
    High-SpeedParallelLFSRArchitecturesBasedonImprovedState-SpaceTransformations
  • 所需E币: 1
    时间: 2022-1-13 15:32
    大小: 6.16MB
    上传者: qq_yousee
    PCIExpressBaseSpecificationRevision3.0
  • 所需E币: 5
    时间: 2019-12-28 19:21
    大小: 55.67KB
    上传者: quw431979_163.com
    电流反馈半桥镇流器电路的晶体管的基极驱动FACTSHEET046Anelectronicballast:basedriveoptimisationIntroductionBasedriveoptimisationThisFactsheetinvestigatesthetransistorbasedriveThetransformer’sauxiliarywindingswhichprovidebasecircuitinacurrentfedhalfbridgeballast.Figure1drivemightcontainjustoneortwoturnseach.Inordershowsthesimplifiedcircuit.Theeffectonswitchingtoproviderapidtransistorturn-off,theirpeakloadedwaveformsofprogressingfromasimplebasedriveoutputvoltagewouldneedtobesuchthatthetransistorcircuittotheoptimisedsolutionwillbeshown.’sees’aturn-offvoltageofaro……
  • 所需E币: 3
    时间: 2019-12-24 21:52
    大小: 355.23KB
    上传者: 16245458_qq.com
    Abstract:ThisarticledescribestheAntennaInterfaceStandardsGroup(AISG)standardintelecommunicationsanddetailsitshardwareimplementation.ItexplainshowafullyintegratedtransceiversuchastheMAX9947canhelpreducespaceandcost,andsolvebusarbitrationsinbase-stationtowerequipment.Maxim>DesignSupport>TechnicalDocuments>ApplicationNotes>AmplifierandComparatorCircuits>APP4652Maxim>DesignSupport>TechnicalDocuments>ApplicationNotes>Basestations/WirelessInfrastructure>APP4652Maxim>DesignSupport>TechnicalDocuments>ApplicationNotes>CommunicationsCircuits>APP4652Keywords:AISG,transceiver,communication,basestation,telecommunications,integratedtransceiver,smartphoneApr06,2012APPLICATIONNOTE4652SimplifyAISGControlSystemsbyIntegratingtheHardwareDiscreteTransceiverBy:MaurizioGavardoni,ProductDefinerApr06,2012Abstract:ThisarticledescribestheAntennaInt……
  • 所需E币: 5
    时间: 2019-12-24 19:26
    大小: 355.23KB
    上传者: 978461154_qq
    通过整合硬件分立收发器简化AISG的控制系统Maxim>DesignSupport>TechnicalDocuments>ApplicationNotes>AmplifierandComparatorCircuits>APP4652Maxim>DesignSupport>TechnicalDocuments>ApplicationNotes>Basestations/WirelessInfrastructure>APP4652Maxim>DesignSupport>TechnicalDocuments>ApplicationNotes>CommunicationsCircuits>APP4652Keywords:AISG,transceiver,communication,basestation,telecommunications,integratedtransceiver,smartphoneApr06,2012APPLICATIONNOTE4652SimplifyAISGControlSystemsbyIntegratingtheHardwareDiscreteTransceiverBy:MaurizioGavardoni,ProductDefinerApr06,2012Abstract:ThisarticledescribestheAntennaInt……
  • 所需E币: 5
    时间: 2019-12-24 19:26
    大小: 93.26KB
    上传者: 978461154_qq
    摘要:MAX2550是一个完整的单芯片UMTS波段1femtocell应用的无线电收发器。RD2550参考设计是基于MAX2550包含所有必要的相关组件,设计和建设具有竞争力的无线解决方案,以支持基站收发器(BTS)频段:1920MHz至1980MHz(RX)和2110MHz至2170MHz(TX)。RD2550也支持下行周围宏蜂窝的监测。这使系统能够选择最合适的工作条件(功率,编码,频率,容量等)。Maxim>DesignSupport>TechnicalDocuments>ApplicationNotes>Automotive>APP5346Maxim>DesignSupport>TechnicalDocuments>ApplicationNotes>Power-SupplyCircuits>APP5346Keywords:automotive,powercontrol,infotainment,bodyelectronics,enginecontrol,powertrain,ISO9000,TS16949Apr02,2012APPLICATIONNOTE5346PowerControlforAutomotiveApplicationsBy:MasayukiNakagawaApr02,2012Abstract:Thisarticlediscussestherequirementsanddesignconsiderationsforautomotiveapplications,includingthoseforenginecontrol,infotainment,andbodyelectronics.ItalsodiscussesseveralMaximdevicesthatareidealforautomotivepowerapplica……
  • 所需E币: 3
    时间: 2019-12-24 19:26
    大小: 354.94KB
    上传者: wsu_w_hotmail.com
    摘要:本应用笔记讨论3G蜂窝femtocell基站的开发和部署。最后一公里“住宅连接在人口密集的城市环境和增加系统容量的技术难题进行了讨论,与3G毫微微蜂窝基站具有成本效益的解决方案。Maxim的兼容3GPPTS25.104的收发器解决方案,提出完整的无线电参考,如RD2550设计。有关的RD2550的详细信息,请参阅参考设计5364“,Femtocell的无线电参考设计采用MAX2550-MAX2553收发器。”Maxim>DesignSupport>TechnicalDocuments>ApplicationNotes>Basestations/WirelessInfrastructure>APP5331Maxim>DesignSupport>TechnicalDocuments>ApplicationNotes>WirelessandRF>APP5331Keywords:femto,femtocell,basestation,basestation,smallcell,macrocell,transceiver,3G,UMTS,WCDMA,cdma2000,cellular,TS25.104,EVM,transmitter,receiverApr11,2012APPLICATIONNOTE5331EmployingaSingle-ChipTransceiverinFemtocellBase-StationApplicationsBy:JerryWeiApr11,2012Abstract:Thisapplicationnotediscussesthedevelopmentanddeploymentof3Gcellularfemtocellbasestations.Thetechnicalchallengesforlast-……
  • 所需E币: 5
    时间: 2019-12-24 19:20
    大小: 156.1KB
    上传者: quw431979_163.com
    摘要:MAX2550是一个完整的单芯片UMTS波段1femtocell应用的无线电收发器。RD2550参考设计是基于MAX2550包含所有必要的相关组件,设计和建设具有竞争力的无线解决方案,以支持基站收发器(BTS)频段:1920MHz至1980MHz(RX)和2110MHz至2170MHz(TX)。RD2550也支持下行周围宏蜂窝的监测。这使系统能够选择最合适的工作条件(功率,编码,频率,容量等)。Maxim>DesignSupport>TechnicalDocuments>ReferenceDesigns>Basestations/WirelessInfrastructure>APP5364Maxim>DesignSupport>TechnicalDocuments>ReferenceDesigns>WirelessandRF>APP5364Keywords:femto,UMTS,band1,GSM,WCDMA-FDD,downlink,uplink,femtocell,basestation,basestation,smallcell,macrocell,transceiver,3G,WCDMA,cdma2000,cellular,TS25.104,EVM,transmitter,receiverApr11,2012REFERENCEDESIGN5364INCLUDES:TestedCircuitSchematicBOMDescriptionFemtocellRadioReferenceDesignsUsingtheMAX2550……
  • 所需E币: 3
    时间: 2019-12-24 19:20
    大小: 354.94KB
    上传者: givh79_163.com
    摘要:本应用笔记讨论3G蜂窝femtocell基站的开发和部署。最后一公里“住宅连接在人口密集的城市环境和增加系统容量的技术难题进行了讨论,与3G毫微微蜂窝基站具有成本效益的解决方案。Maxim的兼容3GPPTS25.104的收发器解决方案,提出完整的无线电参考,如RD2550设计。有关的RD2550的详细信息,请参阅参考设计5364“,Femtocell的无线电参考设计采用MAX2550-MAX2553收发器。”Maxim>DesignSupport>TechnicalDocuments>ApplicationNotes>Basestations/WirelessInfrastructure>APP5331Maxim>DesignSupport>TechnicalDocuments>ApplicationNotes>WirelessandRF>APP5331Keywords:femto,femtocell,basestation,basestation,smallcell,macrocell,transceiver,3G,UMTS,WCDMA,cdma2000,cellular,TS25.104,EVM,transmitter,receiverApr11,2012APPLICATIONNOTE5331EmployingaSingle-ChipTransceiverinFemtocellBase-StationApplicationsBy:JerryWeiApr11,2012Abstract:Thisapplicationnotediscussesthedevelopmentanddeploymentof3Gcellularfemtocellbasestations.Thetechnicalchallengesforlast-……
  • 所需E币: 3
    时间: 2019-12-24 18:23
    大小: 60.17KB
    上传者: 978461154_qq
    摘要:Maxim的MAX1385评估板(EVkit)的软件包括Windows®图形用户界面(GUI)程序;然而,更新此显示的时间成本与控制回路的干扰。本应用笔记显示了更加优化的闭环控制方案,使用一个控制台菜单系统,而不是一个GUI。Maxim>AppNotes>COMMUNICATIONSCIRCUITSTEMPERATURESENSORSandTHERMALMANAGEMENTKeywords:controlloop,LDMOS,FET,bias,basestation,poweramplifier,RFJun10,2007APPLICATIONNOTE4065ImplementingaMAX1385-BasedControlLoopinC/C++Abstract:Maxim'sMAX1385evaluationkit(EVkit)softwareincludesaWindowsgraphicaluserinterface(GUI)program;however,thetimecostofupdatingthisdisplayinterfereswiththecontrolloop.Thisapplicationnoteshowsamoreoptimalcontrol-loopprogram,usingaconsolemenusysteminsteadofaGUI.WhenusedwiththeMAX1385EVKIT+demoboard,thecontrolloopachievesaregulationaccuracyof±2%.ThisaccuracyislimitedbythegatedriveroutputstepsizeandtheFETtransconductance.Drain-curr……