BasicKnowledgeCSharp/LessonsAndTasks/Lesson 62 - Свойства get, set ключевое слово value, авто-свойства/Program.cs
Dvurechensky bf6a7c2b4e 1.1
2025-05-12 02:48:54 +03:00

32 lines
578 B
C#

/*
* Author: Nikolay Dvurechensky
* Site: https://www.dvurechensky.pro/
* Gmail: dvurechenskysoft@gmail.com
* Last Updated: 12 мая 2025 02:47:11
* Version: 1.0.3
*/
using System;
/*
* Сыойства (Properties)
*
* Автоматические свойства (prop)
*/
class Point
{
private int x;
public void SetX(int x) => this.x = x;
public int GetX() => x;
}
class Program
{
static void Main()
{
Point point = new Point();
point.SetX(5);
Console.WriteLine(point.GetX());
Console.ReadKey();
}
}