فهرست منبع

Добавьте файлы проекта.

Arina 7 ماه پیش
والد
کامیت
e893a6be6d
4فایلهای تغییر یافته به همراه124 افزوده شده و 0 حذف شده
  1. 25 0
      Prac2.sln
  2. 57 0
      Prac2/NewClass.cs
  3. 10 0
      Prac2/Prac2.csproj
  4. 32 0
      Prac2/Program.cs

+ 25 - 0
Prac2.sln

@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.6.33723.286
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Prac2", "Prac2\Prac2.csproj", "{9BC5228B-3076-4D9B-B571-2D741C9D9CBD}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{9BC5228B-3076-4D9B-B571-2D741C9D9CBD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{9BC5228B-3076-4D9B-B571-2D741C9D9CBD}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{9BC5228B-3076-4D9B-B571-2D741C9D9CBD}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{9BC5228B-3076-4D9B-B571-2D741C9D9CBD}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {295E9BC2-DD78-4ABB-A179-73C735CA524C}
+	EndGlobalSection
+EndGlobal

+ 57 - 0
Prac2/NewClass.cs

@@ -0,0 +1,57 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Prac2
+{
+    internal class NewClass
+    {
+        internal abstract class Class1
+        {
+            public abstract int summaab(int a, int b);// Возвращает результат суммы а и б
+            public abstract void PrintYouMessage(string message);// Просто воид и возвращает ваше написанное
+            public abstract void PrintTodayDate();// Третий метод который выводит дату дня
+        }
+        internal class BaseClass2 : Class1
+        {
+            // Переопределение методов
+            public override int summaab(int a, int b)
+            {
+                return a+b;
+            }
+
+            public override void PrintYouMessage(string message)
+            {
+                Console.WriteLine(message);
+            }
+
+            public override void PrintTodayDate()
+            {
+                DateTime today = DateTime.Today;
+                Console.WriteLine("Если вы не забыли, сегодня: {0}", today);
+            }
+        }
+
+        internal class ProizvClass : BaseClass2
+        {
+
+            new public int summaab(int a)// Замещаем метод на другой из базового класса ( главное тут нью) типа создаем новый 
+            {
+                return a*9;
+            }
+
+            public override void PrintYouMessage(string message)// Переопределяем метод из базового класса (мы можем делать в этом методе что захотим, но только с тем самыми параметрами)
+            {
+                Console.WriteLine($"Вы написали: {message}");
+            }
+
+            public void SOS()// Добавим уникальный метод 
+            {
+                Console.WriteLine("Тут ничего нет :(");
+            }
+            
+        }
+    }
+}

+ 10 - 0
Prac2/Prac2.csproj

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

+ 32 - 0
Prac2/Program.cs

@@ -0,0 +1,32 @@
+using System;
+using System.Numerics;
+using static Prac2.NewClass;
+
+namespace Prac2
+{
+    internal class Program
+    {
+        static void Main(string[] args)
+        {
+            BaseClass2 par = new BaseClass2();
+            ProizvClass oi = new ProizvClass();
+            Console.WriteLine("Введите цифру:");
+            int c =Convert.ToInt32(Console.ReadLine());
+            Console.WriteLine(oi.summaab(c));
+            Console.WriteLine("Ввиде ваше преложение или слово");
+            string name = Convert.ToString(Console.ReadLine());
+            oi.PrintYouMessage(name);
+            oi.SOS();
+
+
+        }
+    }
+}
+
+
+
+
+
+
+
+