Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace TestsDecimals
- {
- public static class Program
- {
- public static void Main(string[] args)
- {
- var a = new A();
- a.SetA(5);
- a.SetB(6);
- Console.WriteLine(a.GetA); // 5
- Console.WriteLine(a.GetB); // 6
- Console.WriteLine(a.C); // 5 * 6 = 30
- }
- }
- public class A
- {
- private int _a;
- private int _b;
- // setters
- public void SetA(int a) => _a = a;
- public void SetB(int b) => _b = b;
- // getters
- public int GetA => _a;
- public int GetB => _b;
- public int C => _a * _b;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment