b
This commit is contained in:
@@ -2,20 +2,20 @@
|
|||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using static System.Net.Mime.MediaTypeNames;
|
using static System.Net.Mime.MediaTypeNames;
|
||||||
|
|
||||||
enum _Type_Animal{
|
public enum _Type_Animal{
|
||||||
herbivorous, // травоядный
|
herbivorous, // травоядный
|
||||||
predator, // хищник
|
predator, // хищник
|
||||||
omnivorous, // всеядный
|
omnivorous, // всеядный
|
||||||
insectivorous // насекомоядный
|
insectivorous // насекомоядный
|
||||||
}
|
}
|
||||||
|
|
||||||
enum _Habitat{
|
public enum _Habitat{
|
||||||
water_env, // водная среда
|
water_env, // водная среда
|
||||||
earth_env, // наземная среда
|
earth_env, // наземная среда
|
||||||
wind_env // воздушная среда
|
wind_env // воздушная среда
|
||||||
}
|
}
|
||||||
|
|
||||||
enum _Continent{
|
public enum _Continent{
|
||||||
africa,
|
africa,
|
||||||
north_am,
|
north_am,
|
||||||
south_am,
|
south_am,
|
||||||
@@ -28,71 +28,74 @@ class Animal{
|
|||||||
|
|
||||||
//-constructors-----------------------------------
|
//-constructors-----------------------------------
|
||||||
public Animal(){
|
public Animal(){
|
||||||
Console.WriteLine("базовый конструктор");
|
Console.WriteLine(">>базовый конструктор");
|
||||||
|
_name = "пусто";
|
||||||
|
_age = 0;
|
||||||
|
_count_limbs = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Animal(string _name_, int _age_, int _count_limbs_,
|
public Animal(string _name_, int _age_, int _count_limbs_,
|
||||||
_Type_Animal type_animal, _Habitat habitat,
|
_Type_Animal _type_animal_, _Habitat _habitat_,
|
||||||
_Continent continent){
|
_Continent _continent_){
|
||||||
|
|
||||||
Console.WriteLine("конструктор с параметрами");
|
Console.WriteLine(">>конструктор с параметрами");
|
||||||
_name = _name_;
|
_name = _name_;
|
||||||
_age = _age_;
|
_age = _age_;
|
||||||
_count_limbs = _count_limbs_;
|
_count_limbs = _count_limbs_;
|
||||||
|
|
||||||
Type_animal = type_animal;
|
type_animal = _type_animal_;
|
||||||
Habitat = habitat;
|
habitat = _habitat_;
|
||||||
Continent = continent;
|
continent = _continent_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-override-operators-----------------------------
|
//-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);
|
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);
|
return !(animal_1 == animal_2);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-methods----------------------------------------
|
//-methods----------------------------------------
|
||||||
public void GetSound(){
|
public void GetSound(){
|
||||||
Console.WriteLine("издает звук!");
|
Console.WriteLine(" >издает звук!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CanSwim(){
|
public void CanSwim(){
|
||||||
if (Habitat == _Habitat.water_env){
|
if (habitat == _Habitat.water_env){
|
||||||
Console.WriteLine("животное умеет плавать!");
|
Console.WriteLine(" >животное умеет плавать!");
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
Console.WriteLine("животное не умеет плавать!");
|
Console.WriteLine(" >животное не умеет плавать!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CanFly(){
|
public void CanFly(){
|
||||||
if (Habitat == _Habitat.wind_env){
|
if (habitat == _Habitat.wind_env){
|
||||||
Console.WriteLine("животное умеет летать!");
|
Console.WriteLine(" >животное умеет летать!");
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
Console.WriteLine("животное не умеет летать!");
|
Console.WriteLine(" >животное не умеет летать!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ExistsTail(){
|
public void ExistsTail(){
|
||||||
if (Type_animal == _Type_Animal.insectivorous){
|
if (type_animal == _Type_Animal.insectivorous){
|
||||||
Console.WriteLine("у животного нет хвоста!");
|
Console.WriteLine(" >у животного нет хвоста!");
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
Console.WriteLine("у животного есть хвост!");
|
Console.WriteLine(" >у животного есть хвост!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GetAllData(){
|
public void GetAllData(){
|
||||||
Console.WriteLine("имя: " + Name);
|
Console.WriteLine("имя: " + _name);
|
||||||
Console.WriteLine("возраст: " + Age);
|
Console.WriteLine("возраст: " + _age);
|
||||||
Console.WriteLine("количество конечностей: " + Count_Limbs);
|
Console.WriteLine("количество конечностей: " + _count_limbs);
|
||||||
Console.WriteLine("тип животного: " + Type_animal);
|
Console.WriteLine("тип животного: " + type_animal);
|
||||||
Console.WriteLine("среда обитания: " + Habitat);
|
Console.WriteLine("среда обитания: " + habitat);
|
||||||
Console.WriteLine("континент: " + Continent);
|
Console.WriteLine("континент: " + continent);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-public-fields----------------------------------
|
//-public-fields----------------------------------
|
||||||
@@ -118,7 +121,7 @@ class Animal{
|
|||||||
private string _name;
|
private string _name;
|
||||||
private int _age;
|
private int _age;
|
||||||
private int _count_limbs;
|
private int _count_limbs;
|
||||||
private _Type_Animal Type_animal{ set; }
|
private _Type_Animal type_animal;
|
||||||
private _Habitat Habitat{ set; }
|
private _Habitat habitat;
|
||||||
private _Continent Continent{ set; }
|
private _Continent continent;
|
||||||
}
|
}
|
||||||
+55
-38
@@ -1,50 +1,67 @@
|
|||||||
Console.WriteLine("дочерний класс cat:\n");
|
Console.WriteLine("дочерний класс cat:");
|
||||||
Animal cat = new Animal("барсик", 5, 6, type_animal.predator,
|
Animal cat = new Animal("барсик", 5, 6, _Type_Animal.predator,
|
||||||
habitat.earth_env, continent.eurasia);
|
_Habitat.earth_env, _Continent.eurasia);
|
||||||
cat.GetSound();
|
cat.GetSound();
|
||||||
cat.CanSwim();
|
cat.CanSwim();
|
||||||
cat.CanFly();
|
cat.CanFly();
|
||||||
cat.ExistsTail();
|
cat.ExistsTail();
|
||||||
cat.GetllData();
|
cat.GetAllData();
|
||||||
|
Console.WriteLine("");
|
||||||
|
|
||||||
|
Console.WriteLine("дочерний класс dog:");
|
||||||
|
Animal dog = new Animal();
|
||||||
|
dog.GetAllData();
|
||||||
|
Console.WriteLine("");
|
||||||
|
|
||||||
|
|
||||||
// Console.WriteLine("дочерний класс dog:\n");
|
Console.WriteLine("дочерний класс pigeon:");
|
||||||
// Animal dog = new Animal();
|
Animal pigeon = new Animal("голубь", 1, 5, _Type_Animal.insectivorous, _Habitat.wind_env,
|
||||||
// dog.Get_all_data();
|
_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");
|
Console.WriteLine("кот равен голубю?:");
|
||||||
// Animal pigeon = new Animal("голубь", 1, 5, "wind", "insectivorous", "africa");
|
if (cat == pigeon)
|
||||||
// pigeon.GetSound();
|
{
|
||||||
// pigeon.CanFly();
|
Console.WriteLine("да!");
|
||||||
// pigeon.CanSwim();
|
}
|
||||||
// pigeon.ExistsTail();
|
else{
|
||||||
// pigeon.Get_all_data();
|
Console.WriteLine("нет!");
|
||||||
|
}
|
||||||
|
Console.WriteLine("");
|
||||||
|
|
||||||
// Console.WriteLine("дочерний класс pigeon2:\n");
|
Console.WriteLine("голубь2 равен голубю?:");
|
||||||
// Animal pigeon2 = new Animal("голубь_2", 0, 5, "wind", "insectivorous", "eurasia");
|
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");
|
Figure square = new Figure(10.5, 30.9);
|
||||||
// if (cat == pigeon)
|
Console.WriteLine("площадь квадрата равна: " + square.Square);
|
||||||
// {
|
|
||||||
// Console.WriteLine("да!");
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Console.WriteLine("голубь2 равен голубю?:\n");
|
Figure trapeziod = new Figure(10.5, 30.9, 5.5);
|
||||||
// if (pigeon2 == pigeon)
|
Console.WriteLine("площадь трапеции равна: " + trapeziod.Square);
|
||||||
// {
|
|
||||||
// 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);
|
|
||||||
Executable
BIN
Binary file not shown.
@@ -1,23 +1,23 @@
|
|||||||
{
|
{
|
||||||
"runtimeTarget": {
|
"runtimeTarget": {
|
||||||
"name": ".NETCoreApp,Version=v10.0",
|
"name": ".NETCoreApp,Version=v10.0",
|
||||||
"signature": ""
|
"signature": ""
|
||||||
},
|
},
|
||||||
"compilationOptions": {},
|
"compilationOptions": {},
|
||||||
"targets": {
|
"targets": {
|
||||||
".NETCoreApp,Version=v10.0": {
|
".NETCoreApp,Version=v10.0": {
|
||||||
"oop_1/1.0.0": {
|
"oop_1/1.0.0": {
|
||||||
"runtime": {
|
"runtime": {
|
||||||
"oop_1.dll": {}
|
"oop_1.dll": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"libraries": {
|
"libraries": {
|
||||||
"oop_1/1.0.0": {
|
"oop_1/1.0.0": {
|
||||||
"type": "project",
|
"type": "project",
|
||||||
"serviceable": false,
|
"serviceable": false,
|
||||||
"sha512": ""
|
"sha512": ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Binary file not shown.
Binary file not shown.
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"runtimeOptions": {
|
"runtimeOptions": {
|
||||||
"tfm": "net10.0",
|
"tfm": "net10.0",
|
||||||
"framework": {
|
"framework": {
|
||||||
"name": "Microsoft.NETCore.App",
|
"name": "Microsoft.NETCore.App",
|
||||||
"version": "10.0.0"
|
"version": "10.0.0"
|
||||||
},
|
},
|
||||||
"configProperties": {
|
"configProperties": {
|
||||||
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
|
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Executable
BIN
Binary file not shown.
@@ -13,7 +13,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("oop_1")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("oop_1")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[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.AssemblyProductAttribute("oop_1")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("oop_1")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("oop_1")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
f0381d2845e66a0240164ac3147a921124da832ce87f7569a7ef993e016b07c4
|
4eb4b0b0170d83b7f35ba2418a4226c93c11e912f6f3e3e3bdeae7c1a0b38c77
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ build_property.PlatformNeutralAssembly =
|
|||||||
build_property.EnforceExtendedAnalyzerRules =
|
build_property.EnforceExtendedAnalyzerRules =
|
||||||
build_property._SupportedPlatformList = Linux,macOS,Windows
|
build_property._SupportedPlatformList = Linux,macOS,Windows
|
||||||
build_property.RootNamespace = oop_1
|
build_property.RootNamespace = oop_1
|
||||||
build_property.ProjectDir = /home/ivan/oop_cs/
|
build_property.ProjectDir = /home/ivan/study_oop1/
|
||||||
build_property.EnableComHosting =
|
build_property.EnableComHosting =
|
||||||
build_property.EnableGeneratedComInterfaceComImportInterop =
|
build_property.EnableGeneratedComInterfaceComImportInterop =
|
||||||
build_property.EffectiveAnalysisLevelStyle = 10.0
|
build_property.EffectiveAnalysisLevelStyle = 10.0
|
||||||
|
|||||||
Binary file not shown.
@@ -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/oop_1.dll
|
||||||
/home/ivan/oop_cs/obj/Debug/net10.0/refint/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/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
|
||||||
|
|||||||
Binary file not shown.
@@ -1 +1 @@
|
|||||||
5f1d841fdb158f23c8226209dfda0ac0962705398855826d3e7176c01bdf7366
|
9b0c8e304570150d4cc2be6848386bbcadb786f0b6b9ea4417e194d4e49b3335
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,17 +1,17 @@
|
|||||||
{
|
{
|
||||||
"format": 1,
|
"format": 1,
|
||||||
"restore": {
|
"restore": {
|
||||||
"/home/ivan/oop_cs/oop_1.csproj": {}
|
"/home/ivan/study_oop1/oop_1.csproj": {}
|
||||||
},
|
},
|
||||||
"projects": {
|
"projects": {
|
||||||
"/home/ivan/oop_cs/oop_1.csproj": {
|
"/home/ivan/study_oop1/oop_1.csproj": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"restore": {
|
"restore": {
|
||||||
"projectUniqueName": "/home/ivan/oop_cs/oop_1.csproj",
|
"projectUniqueName": "/home/ivan/study_oop1/oop_1.csproj",
|
||||||
"projectName": "oop_1",
|
"projectName": "oop_1",
|
||||||
"projectPath": "/home/ivan/oop_cs/oop_1.csproj",
|
"projectPath": "/home/ivan/study_oop1/oop_1.csproj",
|
||||||
"packagesPath": "/home/ivan/.nuget/packages/",
|
"packagesPath": "/home/ivan/.nuget/packages/",
|
||||||
"outputPath": "/home/ivan/oop_cs/obj/",
|
"outputPath": "/home/ivan/study_oop1/obj/",
|
||||||
"projectStyle": "PackageReference",
|
"projectStyle": "PackageReference",
|
||||||
"configFilePaths": [
|
"configFilePaths": [
|
||||||
"/home/ivan/.nuget/NuGet/NuGet.Config"
|
"/home/ivan/.nuget/NuGet/NuGet.Config"
|
||||||
|
|||||||
@@ -13,11 +13,11 @@
|
|||||||
"project": {
|
"project": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"restore": {
|
"restore": {
|
||||||
"projectUniqueName": "/home/ivan/oop_cs/oop_1.csproj",
|
"projectUniqueName": "/home/ivan/study_oop1/oop_1.csproj",
|
||||||
"projectName": "oop_1",
|
"projectName": "oop_1",
|
||||||
"projectPath": "/home/ivan/oop_cs/oop_1.csproj",
|
"projectPath": "/home/ivan/study_oop1/oop_1.csproj",
|
||||||
"packagesPath": "/home/ivan/.nuget/packages/",
|
"packagesPath": "/home/ivan/.nuget/packages/",
|
||||||
"outputPath": "/home/ivan/oop_cs/obj/",
|
"outputPath": "/home/ivan/study_oop1/obj/",
|
||||||
"projectStyle": "PackageReference",
|
"projectStyle": "PackageReference",
|
||||||
"configFilePaths": [
|
"configFilePaths": [
|
||||||
"/home/ivan/.nuget/NuGet/NuGet.Config"
|
"/home/ivan/.nuget/NuGet/NuGet.Config"
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"version": 2,
|
"version": 2,
|
||||||
"dgSpecHash": "XSh8HnmCey0=",
|
"dgSpecHash": "PfCk7krDyRE=",
|
||||||
"success": true,
|
"success": true,
|
||||||
"projectFilePath": "/home/ivan/oop_cs/oop_1.csproj",
|
"projectFilePath": "/home/ivan/study_oop1/oop_1.csproj",
|
||||||
"expectedPackageFiles": [
|
"expectedPackageFiles": [
|
||||||
"/home/ivan/.nuget/packages/microsoft.aspnetcore.app.ref/10.0.11/microsoft.aspnetcore.app.ref.10.0.11.nupkg.sha512"
|
"/home/ivan/.nuget/packages/microsoft.aspnetcore.app.ref/10.0.11/microsoft.aspnetcore.app.ref.10.0.11.nupkg.sha512"
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user