Delen via


Calling a .NET Object

A COM client can create an instance of a public class in an assembly and call the public members of the class. The common language runtime marshals the calls to and from the managed object.

The following C++ code example shows how an unmanaged client might create an instance of the managed Loan class and call one of its methods. COM clients cannot access classes directly, but instead call methods, properties, and events exposed by interfaces implemented by the class.

ILoanPtr pILoan(__uuidof(Loan));
pILoan->GetFirstPmtDistribution(payment, &Balance, &Principal, &Interest,
       &MorePmts);

See Also

Tasks

How to: Reference .NET Types from COM

Concepts

Exposing .NET Framework Components to COM

Registering Assemblies with COM

Deploying an Application for COM Access