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

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

Private m_EmployeeId As String
Private m_EmployeeName As String
Private m_JobTitleName As String
Public Function GetName() As String
Return m_EmployeeName
End Function
Public Function GetTitle() As String
Return m_JobTitleName
End Function
End Class

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 methodfor 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 EmployeeImplements 
    IEmployee

Answer: D

No comments:

Post a Comment