.

Friday, November 8, 2013

It 210

Interface Classes The defi nition of an larboard class looks quite similar to the defi nition of a ref class, but it is quite a different concept. An larboard is a class that specifi es a set of functions that argon to be follow throughed by other classes to provide a standardized look of providing some specifi c functionality. Both appraise classes and ref classes arsehole implement port wines. An embrasure does not defi ne any of its function members these are defi ned by to from each one one class that implements the embrasure. You have already met the System::IComparable interface in the context of generic functions where you specifi ed the IComparable interface as a constraint. The IComparable interface specifi es the CompareTo() function for examine objects, so each(prenominal) classes that implement this interface have the corresponding mechanism for comparing objects. You square off an interface that a class implements in the same individualized manner as a base class.
Ordercustompaper.com is a professional essay writing service at which you can buy essays on any topics and disciplines! All custom essays are written by professional writers!
For role model, here s how you could sack up the niche class from the previous example implement the System::IComparable interface: ref class encase : Container, IComparable // Derived class { public: // The function specify by IComparable interface virtual int CompareTo(Object^ obj) { if(Volume() < safe_cast(obj)->Volume()) picture -1; else if(Volume() > safe_cast(obj)->Volume()) return 1; else return 0; } // Rest of the class as before... }; The quote of the interface follows the divulge of the base class, Container . If in that respect were no base class, the in terface give ear alone would appear here. A! ref class pot only have one base class, but it do-nothing implement as many interfaces as you want. The class must defi ne every function specifi ed by each of the interfaces that it claims to implement. The IComparable interface only specifi es one function, but there can be as many functions in an interface as you want. The Box class now defi nes the CompareTo() function with the same signature as the IComparable interface specifi es for the function....If you want to keep a all-inclusive essay, order it on our website: OrderCustomPaper.com

If you want to get a full essay, visit our page: write my paper

No comments:

Post a Comment