Created
April 22, 2025 05:16
-
-
Save JJack55on/fd9dba671edccb5a4d4d5cb359a471a0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using ConsoleApp5; | |
internal class Programm | |
{ | |
public class Hippo | |
{ | |
public const int _fangs = 2; // клыки | |
public static string habitat { get; set; } // ареал | |
public double weight { get; set; } | |
private string degreeOfAgression = "high"; | |
public Hippo() | |
{ | |
Hippo hippo = new Hippo(); | |
Console.WriteLine("Создание объекта Hippo"); | |
habitat = "Africa"; | |
hippo.weight = 3.885; // тонн | |
} | |
public void Print() | |
{ | |
Console.WriteLine($"Ареал:{habitat} Вес:{weight} Степень агрессии:{degreeOfAgression}"); | |
} | |
} | |
public struct Behemoth | |
{ | |
public int _fangs = 2; // клыки | |
public static string habitat { get; set; } // ареал | |
public double weight { get; set; } | |
private readonly string degreeOfAgression = "unknown"; | |
public Behemoth() | |
{ | |
} | |
public Behemoth(string habitat) | |
{ | |
habitat = "Abyss"; | |
} | |
} | |
static void Main(string[] args) | |
{ | |
Hippo hippo = new Hippo(); | |
hippo.weight = 2.800; // тонн | |
Hippo.habitat = "Africa"; | |
Hippo.habitat = "Abyss"; | |
Behemoth biblicalBehemoth = new Behemoth(); | |
biblicalBehemoth.weight = 0; // тонн | |
//Convert.ToString(biblicalBehemoth.weight); | |
if (biblicalBehemoth.weight == 0) | |
{ | |
Console.WriteLine("weight:unknown"); | |
} | |
Behemoth.habitat = "Abyss"; | |
} | |
} |
Comments are disabled for this gist.