October 8th, 2001, 02:00 AM
May i know what is Plain old datatype? What is the difference between pod
and aggregation? What is aggregation?
and aggregation? What is aggregation?
|
Click to See Complete Forum and Search --> : Plain old datatype October 8th, 2001, 02:00 AM May i know what is Plain old datatype? What is the difference between pod and aggregation? What is aggregation? Igor Soukhov October 8th, 2001, 06:20 AM It's just a very different things ... FROM MSDN: ============= Aggregation A composition technique for implementing COM objects. It allows you to build a new object by reusing one or more existing objects' interface implementations. The aggregate object chooses which interfaces to expose to clients, and the interfaces are exposed as if they were implemented by the aggregate object. Clients of the aggregate object communicate only with the aggregate object. See also Aggregate object. Contrast with Containment. ============= of course aggregation can be applied not to COM objects - it can be applied to C++ objects too.. Plain Old Data (POD)- it's the C-styled structs without methods ... just pure data of basic types ... Please - rate answer if it helped you It gives me inspiration when I see myself in the top list =) Best regards, ----------- Igor Soukhov (Brainbench/Tekmetrics ID:50759) igor@soukhov.com | ICQ:57404554 | http://soukhov.com Member of Russian Software Developer Network http://rsdn.ru Graham October 8th, 2001, 08:19 AM Aggregation is also another term for "implemented in terms of". That is, one class presents a particular interface, but it uses another class to do the actual work. For example, the "Pimpl" idiom: // MyClass.h class MyClassImpl; class MyClass { public: int Method1(); // Public methods, etc. private: MyClassImpl* pimpl; }; // MyClass.cpp #include "MyClassImpl.h" MyClass::MyClass : pimpl(new MyClassImpl) { } int MyClass::Method1() { return pimpl->Method1(); } Here, MyClassImpl (the aggregated class) does all the work - the methods in MyClass use it. This idiom allows you to hide all of the internal working of a class from the user of that class. Another example might be if you want to use, say, MFC's CListCtrl, but don't want to use its methods (maybe you might want to port to a different system some day. In this case, you would write a class that presents a list control interface, then aggregate a CListCtrl and delegate the actual working to it. Later on, you replace the CListCtrl with something else, but your wrapper class's interface doesn't change. He who breaks a thing to find out what it is, has left the path of wisdom - Gandalf codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |