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

You write a class named Employee that includes the following code segment. public ref
class Employee{
String^ employeeId;
String^ employeeName;
String^ jobTitleName;public:
String^ GetName() { return employeeName; }
String^ GetJobTitle() { 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