Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Task
- {
- class Program
- {
- static void Main(string[] args)
- {
- DGift certificate = new DGift();
- certificate.Color = "green";
- certificate.Weight = 0.1;
- Console.WriteLine(certificate.ToString());
- ZGift broken_toy = new ZGift();
- broken_toy.Color = "white";
- broken_toy.Weight = 0.7;
- Console.WriteLine(broken_toy.ToString());
- Console.ReadKey();
- }
- }
- }
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Task
- {
- interface IAboutGift
- {
- string ToString();
- }
- }
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Task
- {
- class DGift: IAboutGift
- {
- private double weight; // kg
- private string color;
- public double Weight
- {
- get => this.weight;
- set => this.weight = value;
- }
- public string Color
- {
- get => this.color;
- set => this.color = value;
- }
- public override string ToString()
- {
- return $"Это добрый подарок! Его вес - {weight}, а его цвет - {color}";
- }
- }
- }
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Task
- {
- class ZGift: IAboutGift
- {
- private double weight; // kg
- private string color;
- public double Weight
- {
- get => this.weight;
- set => this.weight = value;
- }
- public string Color
- {
- get => this.color;
- set => this.color = value;
- }
- public override string ToString()
- {
- return $"Это злой подарок! Его вес - {weight}, а его цвет - {color}";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement