diff --git a/Animal.cs b/Animal.cs index 909f728..7cd834a 100755 --- a/Animal.cs +++ b/Animal.cs @@ -2,20 +2,20 @@ using System.Runtime.CompilerServices; using static System.Net.Mime.MediaTypeNames; -enum _Type_Animal{ +public enum _Type_Animal{ herbivorous, // травоядный predator, // хищник omnivorous, // всеядный insectivorous // насекомоядный } -enum _Habitat{ +public enum _Habitat{ water_env, // водная среда earth_env, // наземная среда wind_env // воздушная среда } -enum _Continent{ +public enum _Continent{ africa, north_am, south_am, @@ -28,71 +28,74 @@ class Animal{ //-constructors----------------------------------- public Animal(){ - Console.WriteLine("базовый конструктор"); + Console.WriteLine(">>базовый конструктор"); + _name = "пусто"; + _age = 0; + _count_limbs = 0; } public Animal(string _name_, int _age_, int _count_limbs_, - _Type_Animal type_animal, _Habitat habitat, - _Continent continent){ + _Type_Animal _type_animal_, _Habitat _habitat_, + _Continent _continent_){ - Console.WriteLine("конструктор с параметрами"); + Console.WriteLine(">>конструктор с параметрами"); _name = _name_; _age = _age_; _count_limbs = _count_limbs_; - Type_animal = type_animal; - Habitat = habitat; - Continent = continent; + type_animal = _type_animal_; + habitat = _habitat_; + continent = _continent_; } //-override-operators----------------------------- - public static bool operator ==(Animal animal_1, Animal animal_2){ + public static bool operator ==(Animal? animal_1, Animal? animal_2){ return ReferenceEquals(animal_1, animal_2); } - public static bool operator !=(Animal animal_1, Animal animal_2){ + public static bool operator !=(Animal? animal_1, Animal? animal_2){ return !(animal_1 == animal_2); } //-methods---------------------------------------- public void GetSound(){ - Console.WriteLine("издает звук!"); + Console.WriteLine(" >издает звук!"); } public void CanSwim(){ - if (Habitat == _Habitat.water_env){ - Console.WriteLine("животное умеет плавать!"); + if (habitat == _Habitat.water_env){ + Console.WriteLine(" >животное умеет плавать!"); } else{ - Console.WriteLine("животное не умеет плавать!"); + Console.WriteLine(" >животное не умеет плавать!"); } } public void CanFly(){ - if (Habitat == _Habitat.wind_env){ - Console.WriteLine("животное умеет летать!"); + if (habitat == _Habitat.wind_env){ + Console.WriteLine(" >животное умеет летать!"); } else{ - Console.WriteLine("животное не умеет летать!"); + Console.WriteLine(" >животное не умеет летать!"); } } public void ExistsTail(){ - if (Type_animal == _Type_Animal.insectivorous){ - Console.WriteLine("у животного нет хвоста!"); + if (type_animal == _Type_Animal.insectivorous){ + Console.WriteLine(" >у животного нет хвоста!"); } else{ - Console.WriteLine("у животного есть хвост!"); + Console.WriteLine(" >у животного есть хвост!"); } } public void GetAllData(){ - Console.WriteLine("имя: " + Name); - Console.WriteLine("возраст: " + Age); - Console.WriteLine("количество конечностей: " + Count_Limbs); - Console.WriteLine("тип животного: " + Type_animal); - Console.WriteLine("среда обитания: " + Habitat); - Console.WriteLine("континент: " + Continent); + Console.WriteLine("имя: " + _name); + Console.WriteLine("возраст: " + _age); + Console.WriteLine("количество конечностей: " + _count_limbs); + Console.WriteLine("тип животного: " + type_animal); + Console.WriteLine("среда обитания: " + habitat); + Console.WriteLine("континент: " + continent); } //-public-fields---------------------------------- @@ -118,7 +121,7 @@ class Animal{ private string _name; private int _age; private int _count_limbs; - private _Type_Animal Type_animal{ set; } - private _Habitat Habitat{ set; } - private _Continent Continent{ set; } + private _Type_Animal type_animal; + private _Habitat habitat; + private _Continent continent; } \ No newline at end of file diff --git a/Program.cs b/Program.cs index ca2bc1e..71df188 100755 --- a/Program.cs +++ b/Program.cs @@ -1,50 +1,67 @@ -Console.WriteLine("дочерний класс cat:\n"); -Animal cat = new Animal("барсик", 5, 6, type_animal.predator, - habitat.earth_env, continent.eurasia); +Console.WriteLine("дочерний класс cat:"); +Animal cat = new Animal("барсик", 5, 6, _Type_Animal.predator, + _Habitat.earth_env, _Continent.eurasia); cat.GetSound(); cat.CanSwim(); cat.CanFly(); cat.ExistsTail(); -cat.GetllData(); +cat.GetAllData(); +Console.WriteLine(""); + +Console.WriteLine("дочерний класс dog:"); +Animal dog = new Animal(); +dog.GetAllData(); +Console.WriteLine(""); -// Console.WriteLine("дочерний класс dog:\n"); -// Animal dog = new Animal(); -// dog.Get_all_data(); +Console.WriteLine("дочерний класс pigeon:"); +Animal pigeon = new Animal("голубь", 1, 5, _Type_Animal.insectivorous, _Habitat.wind_env, + _Continent.africa); +pigeon.GetSound(); +pigeon.CanSwim(); +pigeon.CanFly(); +pigeon.ExistsTail(); +pigeon.GetAllData(); +Console.WriteLine(""); + +Console.WriteLine("дочерний класс pigeon2:"); +Animal pigeon2 = new Animal("голубь_2", 0, 5, _Type_Animal.insectivorous, _Habitat.wind_env, + _Continent.eurasia); +Console.WriteLine(""); -// Console.WriteLine("дочерний класс pigeon:\n"); -// Animal pigeon = new Animal("голубь", 1, 5, "wind", "insectivorous", "africa"); -// pigeon.GetSound(); -// pigeon.CanFly(); -// pigeon.CanSwim(); -// pigeon.ExistsTail(); -// pigeon.Get_all_data(); +Console.WriteLine("кот равен голубю?:"); +if (cat == pigeon) +{ + Console.WriteLine("да!"); +} +else{ + Console.WriteLine("нет!"); +} +Console.WriteLine(""); -// Console.WriteLine("дочерний класс pigeon2:\n"); -// Animal pigeon2 = new Animal("голубь_2", 0, 5, "wind", "insectivorous", "eurasia"); +Console.WriteLine("голубь2 равен голубю?:"); +if (pigeon2 == pigeon) +{ + Console.WriteLine("да!"); +} +else{ + Console.WriteLine("нет!"); +} +Console.WriteLine(""); +Console.WriteLine("голубь равен голубю?:"); +if (pigeon == pigeon) +{ + Console.WriteLine("да!"); +} +else{ + Console.WriteLine("нет!"); +} +Console.WriteLine(""); -// Console.WriteLine("кот равен голубю?:\n"); -// if (cat == pigeon) -// { -// Console.WriteLine("да!"); -// } +Figure square = new Figure(10.5, 30.9); +Console.WriteLine("площадь квадрата равна: " + square.Square); -// Console.WriteLine("голубь2 равен голубю?:\n"); -// if (pigeon2 == pigeon) -// { -// Console.WriteLine("да!"); -// } - -// Console.WriteLine("голубь равен голубю?:\n"); -// if (pigeon == pigeon) -// { -// Console.WriteLine("да!"); -// } - -// Figure square = new Figure(10.5, 30.9); -// Console.WriteLine("площадь квадрата равна: " + square.Square); - -// Figure trapeziod = new Figure(10.5, 30.9, 5.5); -// Console.WriteLine("площадь трапеции равна: " + trapeziod.Square); \ No newline at end of file +Figure trapeziod = new Figure(10.5, 30.9, 5.5); +Console.WriteLine("площадь трапеции равна: " + trapeziod.Square); \ No newline at end of file diff --git a/bin/Debug/net10.0/oop_1 b/bin/Debug/net10.0/oop_1 new file mode 100755 index 0000000..96987e6 Binary files /dev/null and b/bin/Debug/net10.0/oop_1 differ diff --git a/bin/Debug/net10.0/oop_1.deps.json b/bin/Debug/net10.0/oop_1.deps.json index f3d0417..9404270 100755 --- a/bin/Debug/net10.0/oop_1.deps.json +++ b/bin/Debug/net10.0/oop_1.deps.json @@ -1,23 +1,23 @@ -{ - "runtimeTarget": { - "name": ".NETCoreApp,Version=v10.0", - "signature": "" - }, - "compilationOptions": {}, - "targets": { - ".NETCoreApp,Version=v10.0": { - "oop_1/1.0.0": { - "runtime": { - "oop_1.dll": {} - } - } - } - }, - "libraries": { - "oop_1/1.0.0": { - "type": "project", - "serviceable": false, - "sha512": "" - } - } +{ + "runtimeTarget": { + "name": ".NETCoreApp,Version=v10.0", + "signature": "" + }, + "compilationOptions": {}, + "targets": { + ".NETCoreApp,Version=v10.0": { + "oop_1/1.0.0": { + "runtime": { + "oop_1.dll": {} + } + } + } + }, + "libraries": { + "oop_1/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + } + } } \ No newline at end of file diff --git a/bin/Debug/net10.0/oop_1.dll b/bin/Debug/net10.0/oop_1.dll index 50bba17..7bd6983 100755 Binary files a/bin/Debug/net10.0/oop_1.dll and b/bin/Debug/net10.0/oop_1.dll differ diff --git a/bin/Debug/net10.0/oop_1.pdb b/bin/Debug/net10.0/oop_1.pdb index b6f5a58..2b6257f 100755 Binary files a/bin/Debug/net10.0/oop_1.pdb and b/bin/Debug/net10.0/oop_1.pdb differ diff --git a/bin/Debug/net10.0/oop_1.runtimeconfig.json b/bin/Debug/net10.0/oop_1.runtimeconfig.json index 7cd647c..01e4519 100755 --- a/bin/Debug/net10.0/oop_1.runtimeconfig.json +++ b/bin/Debug/net10.0/oop_1.runtimeconfig.json @@ -1,12 +1,12 @@ -{ - "runtimeOptions": { - "tfm": "net10.0", - "framework": { - "name": "Microsoft.NETCore.App", - "version": "10.0.0" - }, - "configProperties": { - "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false - } - } +{ + "runtimeOptions": { + "tfm": "net10.0", + "framework": { + "name": "Microsoft.NETCore.App", + "version": "10.0.0" + }, + "configProperties": { + "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false + } + } } \ No newline at end of file diff --git a/obj/Debug/net10.0/apphost b/obj/Debug/net10.0/apphost new file mode 100755 index 0000000..96987e6 Binary files /dev/null and b/obj/Debug/net10.0/apphost differ diff --git a/obj/Debug/net10.0/oop_1.AssemblyInfo.cs b/obj/Debug/net10.0/oop_1.AssemblyInfo.cs index fe5f027..6975394 100755 --- a/obj/Debug/net10.0/oop_1.AssemblyInfo.cs +++ b/obj/Debug/net10.0/oop_1.AssemblyInfo.cs @@ -13,7 +13,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("oop_1")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+308f755be69bf77a9c0c1783c49f73225beec73b")] [assembly: System.Reflection.AssemblyProductAttribute("oop_1")] [assembly: System.Reflection.AssemblyTitleAttribute("oop_1")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/obj/Debug/net10.0/oop_1.AssemblyInfoInputs.cache b/obj/Debug/net10.0/oop_1.AssemblyInfoInputs.cache index 9283025..98ac175 100755 --- a/obj/Debug/net10.0/oop_1.AssemblyInfoInputs.cache +++ b/obj/Debug/net10.0/oop_1.AssemblyInfoInputs.cache @@ -1 +1 @@ -f0381d2845e66a0240164ac3147a921124da832ce87f7569a7ef993e016b07c4 +4eb4b0b0170d83b7f35ba2418a4226c93c11e912f6f3e3e3bdeae7c1a0b38c77 diff --git a/obj/Debug/net10.0/oop_1.GeneratedMSBuildEditorConfig.editorconfig b/obj/Debug/net10.0/oop_1.GeneratedMSBuildEditorConfig.editorconfig index 53101f7..74b5dc8 100755 --- a/obj/Debug/net10.0/oop_1.GeneratedMSBuildEditorConfig.editorconfig +++ b/obj/Debug/net10.0/oop_1.GeneratedMSBuildEditorConfig.editorconfig @@ -10,7 +10,7 @@ build_property.PlatformNeutralAssembly = build_property.EnforceExtendedAnalyzerRules = build_property._SupportedPlatformList = Linux,macOS,Windows build_property.RootNamespace = oop_1 -build_property.ProjectDir = /home/ivan/oop_cs/ +build_property.ProjectDir = /home/ivan/study_oop1/ build_property.EnableComHosting = build_property.EnableGeneratedComInterfaceComImportInterop = build_property.EffectiveAnalysisLevelStyle = 10.0 diff --git a/obj/Debug/net10.0/oop_1.assets.cache b/obj/Debug/net10.0/oop_1.assets.cache index f469b2e..93c63f3 100755 Binary files a/obj/Debug/net10.0/oop_1.assets.cache and b/obj/Debug/net10.0/oop_1.assets.cache differ diff --git a/obj/Debug/net10.0/oop_1.csproj.FileListAbsolute.txt b/obj/Debug/net10.0/oop_1.csproj.FileListAbsolute.txt index 09779ce..18f3996 100755 --- a/obj/Debug/net10.0/oop_1.csproj.FileListAbsolute.txt +++ b/obj/Debug/net10.0/oop_1.csproj.FileListAbsolute.txt @@ -20,3 +20,17 @@ C:/Users/ivan/source/repos/oop_1/oop_1/obj/Debug/net10.0/oop_1.csproj.Up2Date /home/ivan/oop_cs/obj/Debug/net10.0/oop_1.dll /home/ivan/oop_cs/obj/Debug/net10.0/refint/oop_1.dll /home/ivan/oop_cs/obj/Debug/net10.0/oop_1.pdb +/home/ivan/study_oop1/obj/Debug/net10.0/oop_1.GeneratedMSBuildEditorConfig.editorconfig +/home/ivan/study_oop1/obj/Debug/net10.0/oop_1.AssemblyInfoInputs.cache +/home/ivan/study_oop1/obj/Debug/net10.0/oop_1.AssemblyInfo.cs +/home/ivan/study_oop1/obj/Debug/net10.0/oop_1.csproj.CoreCompileInputs.cache +/home/ivan/study_oop1/obj/Debug/net10.0/oop_1.dll +/home/ivan/study_oop1/obj/Debug/net10.0/refint/oop_1.dll +/home/ivan/study_oop1/obj/Debug/net10.0/oop_1.pdb +/home/ivan/study_oop1/bin/Debug/net10.0/oop_1 +/home/ivan/study_oop1/bin/Debug/net10.0/oop_1.deps.json +/home/ivan/study_oop1/bin/Debug/net10.0/oop_1.runtimeconfig.json +/home/ivan/study_oop1/bin/Debug/net10.0/oop_1.dll +/home/ivan/study_oop1/bin/Debug/net10.0/oop_1.pdb +/home/ivan/study_oop1/obj/Debug/net10.0/oop_1.genruntimeconfig.cache +/home/ivan/study_oop1/obj/Debug/net10.0/ref/oop_1.dll diff --git a/obj/Debug/net10.0/oop_1.dll b/obj/Debug/net10.0/oop_1.dll index 50bba17..7bd6983 100755 Binary files a/obj/Debug/net10.0/oop_1.dll and b/obj/Debug/net10.0/oop_1.dll differ diff --git a/obj/Debug/net10.0/oop_1.genruntimeconfig.cache b/obj/Debug/net10.0/oop_1.genruntimeconfig.cache index 67fb7c7..da9cca1 100755 --- a/obj/Debug/net10.0/oop_1.genruntimeconfig.cache +++ b/obj/Debug/net10.0/oop_1.genruntimeconfig.cache @@ -1 +1 @@ -5f1d841fdb158f23c8226209dfda0ac0962705398855826d3e7176c01bdf7366 +9b0c8e304570150d4cc2be6848386bbcadb786f0b6b9ea4417e194d4e49b3335 diff --git a/obj/Debug/net10.0/oop_1.pdb b/obj/Debug/net10.0/oop_1.pdb index b6f5a58..2b6257f 100755 Binary files a/obj/Debug/net10.0/oop_1.pdb and b/obj/Debug/net10.0/oop_1.pdb differ diff --git a/obj/Debug/net10.0/ref/oop_1.dll b/obj/Debug/net10.0/ref/oop_1.dll index a273e33..a682a07 100755 Binary files a/obj/Debug/net10.0/ref/oop_1.dll and b/obj/Debug/net10.0/ref/oop_1.dll differ diff --git a/obj/Debug/net10.0/refint/oop_1.dll b/obj/Debug/net10.0/refint/oop_1.dll index a273e33..a682a07 100755 Binary files a/obj/Debug/net10.0/refint/oop_1.dll and b/obj/Debug/net10.0/refint/oop_1.dll differ diff --git a/obj/oop_1.csproj.nuget.dgspec.json b/obj/oop_1.csproj.nuget.dgspec.json index f9c182c..fa7c4aa 100644 --- a/obj/oop_1.csproj.nuget.dgspec.json +++ b/obj/oop_1.csproj.nuget.dgspec.json @@ -1,17 +1,17 @@ { "format": 1, "restore": { - "/home/ivan/oop_cs/oop_1.csproj": {} + "/home/ivan/study_oop1/oop_1.csproj": {} }, "projects": { - "/home/ivan/oop_cs/oop_1.csproj": { + "/home/ivan/study_oop1/oop_1.csproj": { "version": "1.0.0", "restore": { - "projectUniqueName": "/home/ivan/oop_cs/oop_1.csproj", + "projectUniqueName": "/home/ivan/study_oop1/oop_1.csproj", "projectName": "oop_1", - "projectPath": "/home/ivan/oop_cs/oop_1.csproj", + "projectPath": "/home/ivan/study_oop1/oop_1.csproj", "packagesPath": "/home/ivan/.nuget/packages/", - "outputPath": "/home/ivan/oop_cs/obj/", + "outputPath": "/home/ivan/study_oop1/obj/", "projectStyle": "PackageReference", "configFilePaths": [ "/home/ivan/.nuget/NuGet/NuGet.Config" diff --git a/obj/project.assets.json b/obj/project.assets.json index 5a96f8e..d4e41c3 100644 --- a/obj/project.assets.json +++ b/obj/project.assets.json @@ -13,11 +13,11 @@ "project": { "version": "1.0.0", "restore": { - "projectUniqueName": "/home/ivan/oop_cs/oop_1.csproj", + "projectUniqueName": "/home/ivan/study_oop1/oop_1.csproj", "projectName": "oop_1", - "projectPath": "/home/ivan/oop_cs/oop_1.csproj", + "projectPath": "/home/ivan/study_oop1/oop_1.csproj", "packagesPath": "/home/ivan/.nuget/packages/", - "outputPath": "/home/ivan/oop_cs/obj/", + "outputPath": "/home/ivan/study_oop1/obj/", "projectStyle": "PackageReference", "configFilePaths": [ "/home/ivan/.nuget/NuGet/NuGet.Config" diff --git a/obj/project.nuget.cache b/obj/project.nuget.cache index bd23880..66f1a82 100644 --- a/obj/project.nuget.cache +++ b/obj/project.nuget.cache @@ -1,8 +1,8 @@ { "version": 2, - "dgSpecHash": "XSh8HnmCey0=", + "dgSpecHash": "PfCk7krDyRE=", "success": true, - "projectFilePath": "/home/ivan/oop_cs/oop_1.csproj", + "projectFilePath": "/home/ivan/study_oop1/oop_1.csproj", "expectedPackageFiles": [ "/home/ivan/.nuget/packages/microsoft.aspnetcore.app.ref/10.0.11/microsoft.aspnetcore.app.ref.10.0.11.nupkg.sha512" ],