Guest User

Gopneg Solution

a guest
Jan 24th, 2021
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.60 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. public class Program
  5. {
  6.     public static void Main()
  7.     {
  8.         Person your = new Person();
  9.         Person yourFriend = new Person();
  10.         PersonGroup pidors = your + yourFriend;
  11.         Console.WriteLine("Решение от Жака Фреско");
  12.     }
  13. }
  14.  
  15. class Person
  16. {
  17.     public static PersonGroup operator +(Person firstPerson, Person secondPerson)
  18.     {
  19.         var personGroup = new PersonGroup();
  20.         personGroup.Persons.Add(firstPerson);
  21.         personGroup.Persons.Add(secondPerson);
  22.         return personGroup;
  23.     }
  24. }
  25. class PersonGroup
  26. {
  27.     public List<Person> Persons {get;set;}
  28. }
Advertisement
Add Comment
Please, Sign In to add comment