Overload finally

This commit is contained in:
Geir Okkenhaug Jerstad 2024-11-27 09:43:48 +01:00
parent 8a1b696755
commit 0aa442271f
11 changed files with 150 additions and 2 deletions

View file

@ -0,0 +1,16 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MiniOverloads", "MiniOverloads\MiniOverloads.csproj", "{6DCE59CD-8964-4AA0-B9DE-BB9B5F4FB9DB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6DCE59CD-8964-4AA0-B9DE-BB9B5F4FB9DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6DCE59CD-8964-4AA0-B9DE-BB9B5F4FB9DB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6DCE59CD-8964-4AA0-B9DE-BB9B5F4FB9DB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6DCE59CD-8964-4AA0-B9DE-BB9B5F4FB9DB}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View file

@ -0,0 +1,8 @@
using MiniOverloads;
Console.Clear();
Message writeMessage = new Message("Hei og velkommen", ", du er grei");
writeMessage.PrintWelcomeMessage();

View file

@ -0,0 +1,27 @@
namespace MiniOverloads
{
public class Message
{
string MessageText { get; set; }
string Kompliment { get; set; }
public Message(string messageText)
{
MessageText = messageText;
}
public Message(string messageText, string kompliment)
{
MessageText = messageText;
Kompliment = kompliment;
}
public void PrintWelcomeMessage()
{
Console.WriteLine($"{MessageText} {Kompliment}");
}
}
}