Question:

You write a class named Employee that includes the following code segment.

public class Employee {

string employeeId, employeeName, jobTitleName;

public string GetName() { return employeeName; }

public string GetTitle() { return jobTitleName; }

You need to expose this class to COM in a type library. The COM interface must also facilitate forward-compatibility across new versions of the Employee class.

You need to choose a method for generating the COM interface.

What should you do?

 

A Define an interface for the class and add the following attribute to the class definition.
[ClassInterface(ClassInterfaceType.None)]
public class Employee : IEmployee { 

B Add the following attribute to the class definition.
[ComVisible(true)]
public class Employee { 

C Add the following attribute to the class definition.
[ClassInterface(ClassInterfaceType.None)]
public class Employee { 

D Add the following attribute to the class definition.
[ClassInterface(ClassInterfaceType.AutoDual)]
public class Employee { 

+ Answer
+ Report
Total Preview: 686

Copyright © 2024. Powered by Intellect Software Ltd