1
Folks;상속 된 공유 메서드에서 클래스 형식을 얻는 방법
Public Class MasterA
Inherits Underling
End Class
Public Class MasterB
Inherits Underling
End Class
Public Mustinherit Class Underling
Sub DoSomething()
Me.GetType 'Using the instance, I can get the class.
end sub
Shared function() as ???? 'How can I define the return type based on the class that inherited me?
'Me.GetType 'Won't work as this is a shared function with no instance 'Me'
End Function
End class
OK :
코드처럼 보인다. 문제는 다른 클래스에서 상속 된 공유 함수 내에서 클래스 유형을 가져 오는 방법이 있습니까?
저는 XML serializer/desrializer를 상속 가능한 클래스로 구축하여 상속받은 클래스를 XML 파일로 다시 세리 할 수 있으며 다시 사용할 수 있습니다. 이를 위해 각 클래스 유형에 대한 serializer/deserializer를 작성하는 대신 기능을 상속 받고 싶습니다.
그렇지만 공유 기능에서 나를 계승 한 clas를 확인할 수 있어야합니다.