Guest User

Untitled

a guest
Jun 22nd, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text.RegularExpressions;
  5.  
  6. namespace Rextester
  7. {
  8. public class Program
  9. {
  10. public static void Main(string[] args)
  11. {
  12. Carro carro = new Carro();
  13.  
  14. //Como Ler esse campo?
  15. Console.WriteLine(carro.Tipo.Placa);
  16. }
  17.  
  18.  
  19. public class Carro
  20. {
  21. public MarcaDeCarro Tipo {get; set;}
  22.  
  23. public Carro(){Tipo = new Sedan();}
  24. }
  25.  
  26. public class Sedan : MarcaDeCarro
  27. {
  28. public int Placa{get;set;}
  29. }
  30.  
  31. public abstract class MarcaDeCarro
  32. {
  33.  
  34. }
  35. }
  36. }
Add Comment
Please, Sign In to add comment