- // smartpointerclient.cpp
- #include <comdef.h>
- #include <iostream.h>
- #include "Componentcomponent.h" // Generated by MIDL
- void main()
- {
- CoInitialize(NULL);
- _COM_SMARTPTR_TYPEDEF(ISum, IID_ISum);
- ISumPtr myRef(CLSID_InsideCOM);
- int result;
- myRef->Sum(5, 13, &result);
- cout << "Client: 5 + 13 = " << result << endl;
- myRef = NULL;
- CoUninitialize();
- }