What should you do?

You work as the application developer at Cert-Tech.com. Cert-Tech.com uses Visual Studio.Net 2005 as its application development platform. You use a Windows XP Professional client computer named Client01 as your development computer.
You are developing a .Net Framework 2.0 application on Client01. You write the code shown below:
Public Class Shape
Private shapeName as String
Public Sub Shape(ByVal shapeName as String)
Me.shapename=shapeName
End Sub
Public Overridable Fuction GetName() As String
Return shapeName
End Function
Private Sub DrawShape()
‘Additional code goes here
End Sub
End Class
You later decide to have the application compiled and registered for COM interoperability. The other developers on your team complaing that they are unable to create an instance of the Shape class in their COM applications. You are required to ensure that COM applications are able to create an instance of the Shape class.
What should you do?

You work as the application developer at Cert-Tech.com. Cert-Tech.com uses Visual Studio.Net 2005 as its application development platform. You use a Windows XP Professional client computer named Client01 as your development computer.
You are developing a .Net Framework 2.0 application on Client01. You write the code shown below:
Public Class Shape
Private shapeName as String

Public Sub Shape(ByVal shapeName as String)
Me.shapename=shapeName
End Sub

Public Overridable Fuction GetName() As String
Return shapeName
End Function

Private Sub DrawShape()
‘Additional code goes here
End Sub
End Class

You later decide to have the application compiled and registered for COM interoperability. The other developers on your team complaing that they are unable to create an instance of the Shape class  in their COM applications. You are required to ensure that COM applications are able to create an instance of the Shape class.
What should you do?

A.
The following code should be added to the Shape class:
Public Sub New()
End Sub

B.
The following ComVisible attribute to the Shape class:
<ComVisible(True)>

C.
The definition of the GetName method should be modified as below:
Public Function GetName() As String
Return shapename
End Function

D.
The follwoing ComVisible attribute should be added to each method of the Shape class:
<ComVisible(True)>



Leave a Reply 1

Your email address will not be published. Required fields are marked *


Dan

Dan

ADMIN: Question does not apply to exam objectives.