Product Home Class IndexDownloadLicense

Mix-ins (implementation inheritance)

A mix-in class is one that provides a single well-defined capability and is designed to be compatible with any other capabilities an inheriting class might provide.

Some mix-ins are used for callback purposes. For example, a class that inherits CK_Callback must provide an implementation for the callback() function (since it is pure virtual in CK_Callback). This allows library to make callbacks to CK_Callback::callback(), which is really a call to user-written code in a user's class. For example:

	class MyClass : public CK_Callback
	    {
	    public:
		void callback(int param) { }
	    }
	
	...
	MyClass *m = new MyClass;
	
	// engine is a pointer to the CK_ddEngine object
	engine->setPollCallback(m);