From 90a05e19d4aee72a593c7d7b512aeb007498773d Mon Sep 17 00:00:00 2001 From: RAJJIT <2.0lairaj@gmail.com> Date: Wed, 23 Oct 2024 22:58:28 +0530 Subject: [PATCH] .net-vb-inherit-area-example-added --- dotNET/vbTheory/InheritArea/InheritArea.sln | 25 +++++++++++++ .../vbTheory/InheritArea/InheritArea.vbproj | 9 +++++ dotNET/vbTheory/InheritArea/Program.vb | 35 +++++++++++++++++++ 3 files changed, 69 insertions(+) create mode 100644 dotNET/vbTheory/InheritArea/InheritArea.sln create mode 100644 dotNET/vbTheory/InheritArea/InheritArea.vbproj create mode 100644 dotNET/vbTheory/InheritArea/Program.vb diff --git a/dotNET/vbTheory/InheritArea/InheritArea.sln b/dotNET/vbTheory/InheritArea/InheritArea.sln new file mode 100644 index 0000000..3e8fc01 --- /dev/null +++ b/dotNET/vbTheory/InheritArea/InheritArea.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.12.35323.107 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "InheritArea", "InheritArea.vbproj", "{45092605-64E0-4196-9352-2E15C128EE72}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {45092605-64E0-4196-9352-2E15C128EE72}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {45092605-64E0-4196-9352-2E15C128EE72}.Debug|Any CPU.Build.0 = Debug|Any CPU + {45092605-64E0-4196-9352-2E15C128EE72}.Release|Any CPU.ActiveCfg = Release|Any CPU + {45092605-64E0-4196-9352-2E15C128EE72}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {E30C6DF2-6A25-4F71-AAB8-2BBBCF09DBDF} + EndGlobalSection +EndGlobal diff --git a/dotNET/vbTheory/InheritArea/InheritArea.vbproj b/dotNET/vbTheory/InheritArea/InheritArea.vbproj new file mode 100644 index 0000000..4ff7d39 --- /dev/null +++ b/dotNET/vbTheory/InheritArea/InheritArea.vbproj @@ -0,0 +1,9 @@ + + + + Exe + InheritArea + net8.0 + + + diff --git a/dotNET/vbTheory/InheritArea/Program.vb b/dotNET/vbTheory/InheritArea/Program.vb new file mode 100644 index 0000000..7bcd1fb --- /dev/null +++ b/dotNET/vbTheory/InheritArea/Program.vb @@ -0,0 +1,35 @@ +Module Module1 + Class Rectangle + Public Length As Integer + Public Width As Integer + + Public Sub SetValues(len As Integer, wid As Integer) + Length = len + Width = wid + End Sub + + Public Function CalculateArea() As Integer + Return Length * Width + End Function + End Class + + Class Square + Inherits Rectangle + + Public Function CalculateSquareArea() As Integer + Return Length * Length + End Function + End Class + + Sub Main() + Dim rect As New Rectangle() + rect.SetValues(5, 10) + Console.WriteLine("Area of Rectangle: " & rect.CalculateArea()) + + Dim sqr As New Square() + sqr.Length = rect.Length + Console.WriteLine("Area of Square (using length from base): " & sqr.CalculateSquareArea()) + + Console.ReadLine() + End Sub +End Module