Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. public abstract class Shape { }
  2. public class Circle: Shape { }
  3.  
  4. public interface IContainer<T>
  5. {
  6. T Figure { get; set; }
  7. }
  8.  
  9. public class Container<T> : IContainer<T>
  10. {
  11. public T Figure { get; set; }
  12.  
  13. public Container(T figure)
  14. {
  15. this.Figure = figure;
  16. }
  17. }
  18.  
  19. class Program
  20. {
  21. static void Main(string[] args)
  22. {
  23. Circle circle = new Circle();
  24. IContainer<Circle> container = new Container<Circle>(circle);
  25. Console.WriteLine(container.Figure.ToString());
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement