i'd like to know if there is a way in which I can "shadow" a function, the following class is in an assembly reference of my current project, i cannot modify in any way the assembly's content.
Public Class CoordinateSpace
Public Function FromPixelsY(ByVal y As Single) As Single
Return (Me.m_originY + ((y * Me.ZoomY) / (Me.m_dpiY / 100.0F)))
End Function
Public Function ToPixelsY(ByVal y As Single) As Single
Dim num2 As Single = ((y - Me.m_originY) / Me.ZoomY) * (Me.m_dpiY / 100.0F)
Me.CheckOverflow(num2)
Return num2
End Function
End Class
In addition, within the assembly i have many calls in many classes like the following:
Public Class Printer
public function testPx() as boolean
dim c as new CoordinateSpace
return c.ToPixelsY(18) > 500
end function
End Class
For my project I need the above class to return what is in FromPixelsY
when a call to ToPixelsY
occurs.
Is there a way to do this? If I inherit the class and override or shadow these methods, when testPx calls function ToPixelsY, it would be actually calling CoordinateSpace method and not my new class' method.
This is in VB.net, but any .NET language for the solution is ok. Hope this was clear, thanks!
That was inheritance
Now, decoration in case class is sealed (
NotInheritable
in VB.NET)