Abstract Class - Example Programs
Abstract Class - Example Programs
NET
Module Module1
MustInherit Class shape
Public MustOverride Function area()
End Class
s = New rectangle
s.area()
Console.ReadKey()
End Sub
End Module
Output
Enter the value of s(side)
12
Area of square withe side value=12 is 144
Enter the value of length and breadth
22
3
Area of rectange with length= 22 and breadth=3 is 66
//2. Simple and Compound Interest using Abstract Class
Module Module1
MustInherit Class interest
Protected p, n, r As Single
Public MustOverride Function intr()
End Class
End Function
End Class
Sub Main()
Dim s As interest
s = New Simpleinterest
s.intr()
s = New compoundinterest
s.intr()
Console.ReadKey()
End Sub
End Module
Output
Enter the values of p,n r
1000
2
3
Simple Interest=60
Enter the values of p,n r
1000
2
5
Compound Interest=1002.5