﻿'Visual Basic 2012 Abstracte Members Abstracte Basis Klassen Class Exercise1Solution Public Shared Sub Main() Dim object1 As Class_1 = New Class_5 ' ok object1.Command1() ' output : "Class_4.Command1()" object1.Command2() ' output : "Class_4.Command2()" 'object1.Command3() ' impossible, no 'Command3()' in 'Class_1' 'object1.Command4() ' impossible, no 'Command4()' in 'Class_1' 'object1.Command5() ' impossible, no 'Command5()' in 'Class_1' 'object1.Command6() ' impossible, no 'Command6()' in 'Class_1' 'object1.Command7() ' impossible, no 'Command7()' in 'Class_1' ' Dim object2 As Class_2 = New Class_2 ' ok object2.Command1() ' output : "Class_2.Command1()" object2.Command2() ' output : "Class_1.Command2()" object2.Command3() ' output : "Class_2.Command3()" object2.Command4() ' output : "Class_2.Command4()" 'object2.Command5() ' impossible, no 'Command5()' in 'Class_2' 'object2.Command6() ' impossible, no 'Command6()' in 'Class_2' 'object2.Command7() ' impossible, no 'Command7()' in 'Class_2' ' Dim object3 As Class_3 = New Class_5 ' ok object3.Command1() ' output : "Class_4.Command1()" object3.Command2() ' output : "Class_4.Command2()" 'object3.Command3() ' impossible, no 'Command3()' in 'Class_3' object3.Command4() ' output : "Class_5.Command4()" object3.Command5() ' output : "Class_5.Command5()" 'object3.Command6() ' impossible, no 'Command6()' in 'Class_3' 'object3.Command7() ' impossible, no 'Command7()' in 'Class_3' ' Dim object4 As Class_5 = New Class_5 ' ok object4.Command1() ' output : "Class_4.Command1()" object4.Command2() ' output : "Class_4.Command2()" 'object4.Command3() ' impossible, no 'Command3()' in 'Class_5' object4.Command4() ' output : "Class_5.Command4()" object4.Command5() ' output : "Class_5.Command5()" object4.Command6() ' output : "Class_4.Command6()" object4.Command7() ' output : "Class_5.Command7()" ' Dim object5 As Class_6 = New Class_6 ' ok 'object5.Command1(object1) ' typefout : Class_1 geen subtype van Class_3 'object5.Command1(object2) ' typefout : Class_1 geen subtype van Class_3 object5.Command1(object3) ' output : "Class_5.Command4()" object5.Command1(object4) ' output : "Class_5.Command4()" object5.Command2(object1) ' output : "Class_4.Command2()" object5.Command2(object2) ' output : "Class_1.Command2()" object5.Command2(object3) ' output : "Class_4.Command2()" object5.Command2(object4) ' output : "Class_4.Command2()" object5.Query3().Command1() ' output : "Class_4.Command1()" object5.Query3().Command2() ' output : "Class_4.Command2()" 'object5.Query3().Command3() ' impossible, no 'Command3()' in 'Class_1' 'object5.Query3().Command4() ' impossible, no 'Command4()' in 'Class_1' 'object5.Query3().Command5() ' impossible, no 'Command5()' in 'Class_1' 'object5.Query3().Command6() ' impossible, no 'Command6()' in 'Class_1' 'object5.Query3().Command7() ' impossible, no 'Command7()' in 'Class_1' ' Console.ReadLine() End Sub End Class 'Bezoek www.vbvoorbeelden.be voor meer Visual Basic voorbeelden. 'Copyright - De Wolf / vbvoorbeelden - 2003-2012 - Alle rechten voorbehouden.