Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace DemoCapsulation
- {
- public class Person
- {
- //полета -> характеристики
- private string name;
- private int age;
- private double salary;
- //get и set
- public string Name { get; set; }
- public int Age { get; set; }
- public double Salary { get; set; }
- //конструктор
- public Person (string name, int age, double salary)
- {
- //нов празен обект
- this.Name = name;
- this.Age = age;
- }
- //методи -> действия
- //1. увеличаване на заплата с 500
- public void IncreaseSalary ()
- {
- Salary += 500;
- }
- //2. отпечатай възрастта
- public static void PrintAge()
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement