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

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. Add the following attribute to the class
    definition.[ClassInterface(ClassInterfaceType.None)]public class Employee {
B. Add the following attribute to the class
    definition.[ClassInterface(ClassInterfaceType.AutoDual)]public class Employee {
C. Add the following attribute to the class definition.[ComVisible(true)]public class
    Employee {
D. Define an interface for the class and add the following attribute to the class
    definition.[ClassInterface(ClassInterfaceType.None)]public class Employee : IEmployee
    {


Answer: D
 

No comments:

Post a Comment