Wednesday, 2 March 2016
Class Inhertis Simple Code
Imports System
Interface IInterfaceExample
End Interface
MustInherit class Test
'public _a as integer
'Public Const _a = 365
public shared _newA as integer = 222
public MustOverride sub A()
end class
class Example1
Inherits Test
Public Overrides Sub A()
MyBase._newA += 1
Console.WriteLine("Example1.A "+ MyBase._newA.tostring)
End Sub
end class
class Example2
Inherits Test
public Overrides sub A()
MyBase._newA -= 1
console.writeLine("Example2.A "+ MyBase._newA.tostring)
end sub
end class
Public Module Module1
Public Sub Main()
dim test1 as Test = new Example1()
test1.A()
dim test2 as Test = new Example2()
test2.A()
End Sub
End Module
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment