Глава 3 Классы и объекты

This commit is contained in:
deadzilla 2026-04-27 23:38:42 +05:00
parent aa050c247f
commit 2101d584f3
13 changed files with 45 additions and 19 deletions

View File

@ -0,0 +1,23 @@
=== Классы и объекты ===
Person tom = new Person();
string personName = tom.name;
int personAge = tom.age;
Console.WriteLine($"name: {personName} age: {personAge}");
tom.name = "Tom";
tom.age = 37;
tom.Print();
class Person
{
public string name = "Undefined";
public int age;
public void Print()
{
Console.WriteLine($"Имя: {name} Возраст: {age}");
}
}
=== ===

View File

@ -1,16 +1,19 @@
//типы данных
int age = 25;
double price = 19.99;
string name = "Vasya";
bool active = true;
char symbol = 'S';
decimal tax = 15.99M;
DateTime today = DateTime.Now;
List<string> names = new List<string> { "Vasya", "Petya" };
Dictionary<int, string> students = new Dictionary<int, string>
Person tom = new Person();
string personName = tom.name;
int personAge = tom.age;
Console.WriteLine($"name: {personName} age: {personAge}");
tom.name = "Tom";
tom.age = 37;
tom.Print();
class Person
{
{1, "Alice" },
{2, "Frank" },
{3, "Ivan"}
};
string[] days = { "Mon", "Tue", "Wed" };
public string name = "Undefined";
public int age;
public void Print()
{
Console.WriteLine($"Имя: {name} Возраст: {age}");
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -13,10 +13,10 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("CSHARP")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+85c2d250c01f4ee1c62a217cda019d8b45da2f44")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+aa050c247f6147a284a534e34522aed399958c7f")]
[assembly: System.Reflection.AssemblyProductAttribute("CSHARP")]
[assembly: System.Reflection.AssemblyTitleAttribute("CSHARP")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class.
// Создано классом WriteCodeFragment MSBuild.

View File

@ -1 +1 @@
3de7edf971a36d8f480ea014734f387790fab06fc009fabab9562c2e90fac240
8b42992521c44adabdfff2f0c94aca9302acbb4a3d22a089bd2074043d71fed8

Binary file not shown.

View File

@ -1 +1 @@
a3bc34b74b754593ef89b2c29aac9a3ffe2f10e122c68a131fbbbdf1953586c3
b35e9c216da37a7db1e57c4dd5dcac470b2c3540edcd108f82c27f7703827df8

Binary file not shown.

Binary file not shown.