Freigeben über


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 code example creates an instance of the Loan class. COM clients cannot access classes directly, but instead call methods, properties, and events exposed by interfaces implemented by the class.

ILoanPtr pILoan(__uuidof(Loan));

The ILoan interface exposes several methods and properties, including the GetFirstPmtDistribution method.

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