Question:You write the following class that has three methods.
Public Class SimpleEmployee
Private m_EmployeeId As String
Private m_EmployeeName As String
Private m_JobTitleName As String
Public Function GetID() As String Return m_EmployeeID
End Function
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 the class to COM in a type library. The COM
interface must not expose the method GetEmployeeId. The GetEmployeeId
method must still be available to managed code. You need to hide the
GetEmployeeID method from the COM interface. What should you do?
 

A Apply the ComVisible attribute to the class and methods in the following manner.
<ComVisible(False)> _
Public Class SimpleEmployee
Private m_EmployeeId As String
Private m_EmployeeName As String
Private m_JobTitleName As String
Public Function GetID() As String
Return m_EmployeeId
End Function
<ComVisible(True)> _
Public Function GetName() As String
Return m_EmployeeName
End Function
<ComVisible(True)> _
Public Function GetTitle() As String
Return m_JobTitleName
End Function End Class 

B Apply the ComVisible attribute to the class and methods in the following manner.
[ <ComVisible(True)> _ Public Class SimpleEmployee
Private m_EmployeeId As String
Private m_EmployeeName As String
Private m_JobTitleName As String
Public Function GetID() As String
"A Composite Solution With Just One Click" - Certification Guaranteed 147 Microsoft 70-536 Exam Return m_EmployeeId
End Function <ComVisible(True)> _
Public Function GetName() As String
Return m_EmployeeName
End Function
<ComVisible(True)> _
Public Function GetTitle() As String
Return m_JobTitleName
End Function End Class 

C Apply the ComVisible attribute to the GetEmployeeId method in the following manner.
Public Class SimpleEmployee
Private m_EmployeeId As String
Private m_EmployeeName As String
Private m_JobTitleName As String
<ComVisible(False)> _
 Public Function
GetID() As String
Return m_EmployeeID
End Function Public Function GetName() As String
Return m_EmployeeName
End Function
Public Function GetTitle() As String
Return m_JobTitleName
End Function End Class 

D Change the access modifier for the GetEmployeeId method in the following manner.
Public Class SimpleEmployee
Private m_EmployeeId As String
Private m_EmployeeName As String
Private m_JobTitleName As String
Protected Function GetID() As String
Return m_EmployeeID
End Function
Public Function GetName() As String
Return m_EmployeeName
End Function Public Function GetTitle() As String
Return m_JobTitleName
End Function End Class 

+ Answer
+ Report
Total Preview: 779

Copyright © 2024. Powered by Intellect Software Ltd