What should you do?

You create an application by using Microsoft Visual Studio .NET 2008 and the .NET Framework 3.5. The application includes a component. The component will be referenced by the .NET and COM applications.

The component contains the following code segment.
public class Employee
{
public Employee(string name)
{}
}

The .NET and COM applications must perform the following tasks:

Create objects of the Employee type.
Use these objects to access the employee details.

You need to ensure that the .NET and COM applications can consume the managed component.
What should you do?

You create an application by using Microsoft Visual Studio .NET 2008 and the .NET Framework 3.5. The application includes a component. The component will be referenced by the .NET and COM applications.

The component contains the following code segment.
public class Employee
{
public Employee(string name)
{}
}

The .NET and COM applications must perform the following tasks:

Create objects of the Employee type.
Use these objects to access the employee details.

You need to ensure that the .NET and COM applications can consume the managed component.
What should you do?

A.
Change the Employee class to a generic class.

B.
Change the constructor to a no-argument constructor.

C.
Set the access modifier of the class to internal.

D.
Set the access modifier of the constructor to protected.

Explanation:
All managed types, methods, properties, fields, and events that you want to expose to COM must be public. Types must have a public default constructor, which is the only constructor that can be invoked through COM.

http://msdn.microsoft.com/en-us/library/aa720072(v=VS.71).aspx



Leave a Reply 0

Your email address will not be published. Required fields are marked *