Click here to Skip to main content
15,885,054 members
Articles / Programming Languages / C++

Aggregation explained

Rate me:
Please Sign up or sign in to vote.
3.88/5 (11 votes)
1 Feb 20072 min read 46.2K   553   30  
Article describing the steps involved to attain aggregation relation between COM components
// ComplexCalculator.idl : IDL source for ComplexCalculator.dll
//

// This file will be processed by the MIDL tool to
// produce the type library (ComplexCalculator.tlb) and marshalling code.

import "oaidl.idl";
import "ocidl.idl";

//Aggregation: copy the object and interface module from calculator.idl
	[
		object,
		uuid(1E48B0F0-010D-4658-A0B6-70300FDA56F1),
		dual,
		helpstring("ISimpleMath Interface"),
		pointer_default(unique)
	]
	interface ISimpleMath : IDispatch
	{
		[id(1), helpstring("method Add")] HRESULT Add([in] int x, [in] int y, [out,retval] int* z );
	};
//End

	[
		object,
		uuid(F4A87CF0-EB3C-447A-8B00-5062ECCBA164),
		dual,
		helpstring("IComplexMath Interface"),
		pointer_default(unique)
	]
	interface IComplexMath : IDispatch
	{
		[id(1), helpstring("method Divide")] HRESULT Divide([in] int x, [in] int y, [out,retval] int* z );
	};

[
	uuid(B6B78EBB-87E3-4738-819B-DDF1903DF46A),
	version(1.0),
	helpstring("ComplexCalculator 1.0 Type Library")
]
library COMPLEXCALCULATORLib
{
	importlib("stdole32.tlb");
	importlib("stdole2.tlb");

	[
		uuid(D90899E4-3043-491E-B606-52FE3B39B104),
		helpstring("ComplexMath Class")
	]
	coclass ComplexMath
	{
		[default] interface IComplexMath;
		interface ISimpleMath;
	};
};

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions