Click here to Skip to main content
15,881,248 members
Articles / Programming Languages / C++

COM Concept : Unleashing Aggregation

Rate me:
Please Sign up or sign in to vote.
4.84/5 (30 votes)
30 Oct 20036 min read 86.9K   1.3K   56  
Unleashing Aggregation
#include<objbase.h>

#define interface struct
#define _STDCALL	 __stdcall

interface ITrignometry : IUnknown {

	virtual void _STDCALL GetSin(double Val1,double* pResult) = 0;
	
};


extern "C" {

	extern const IID IID_ITrignometry;
	
}


class CScientific : public ITrignometry {

public:
	
	// Implementing IUnknown interface.
	virtual HRESULT _STDCALL QueryInterface(const IID& iid,void **ppv);
	virtual ULONG _STDCALL AddRef();
	virtual ULONG _STDCALL Release();

	//Implementing ITrignometry interface.
	virtual void _STDCALL GetSin(double Val1,double* pResult);
	
	// Constructor 
	CScientific();

	// Destructor
	~CScientific();

	// This has been made public, so that we can understand the
	// concept of reference count in Aggregation technique.
	long m_cRef;
	
	IUnknown* m_pInnerUnknown;

};

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
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