b
This commit is contained in:
@@ -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;
|
||||
}
|
||||
+55
-38
@@ -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);
|
||||
Figure trapeziod = new Figure(10.5, 30.9, 5.5);
|
||||
Console.WriteLine("площадь трапеции равна: " + trapeziod.Square);
|
||||
Executable
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Executable
BIN
Binary file not shown.
@@ -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")]
|
||||
|
||||
@@ -1 +1 @@
|
||||
f0381d2845e66a0240164ac3147a921124da832ce87f7569a7ef993e016b07c4
|
||||
4eb4b0b0170d83b7f35ba2418a4226c93c11e912f6f3e3e3bdeae7c1a0b38c77
|
||||
|
||||
@@ -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
|
||||
|
||||
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/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
|
||||
|
||||
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,
|
||||
"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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user