using System;
using clases;
namespace Curso
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Programando en C#");
Modelo modelo = new Modelo();
modelo.Nombre = "MX423-QWK";
modelo.Numero = 123;
Console.WriteLine("Modelo [ {0},{1} ] ",modelo.Nombre,modelo.Numero);
X my_x = new X();
my_x.Valor = 33;
Console.WriteLine("X[{0}]",my_x.Valor);
X my_xy = new Y();
Y my_y = new Y();
CarSalesman carSalesman = new CarSalesman();
carSalesman = new CarSalesman("Fernando","Carraro Aguirre");
Console.WriteLine("{0}",carSalesman.FullName);
ServicioImpl servicioImpl = new ServicioImpl();
servicioImpl.imprimir();
int x = 9;
int y = 21;
Console.WriteLine("{0}",servicioImpl.suma(x,y));
}
}
class X{
private int valor;
public X(){
Console.WriteLine("Objeto X creado e inicializado");
}
public int Valor{
get; set;
}
}
class Y:X{
public Y(){
Console.WriteLine("Objeto Y creado e inicializado");
}
}
class Modelo{
private string nombre;
private int numero;
public Modelo(){
Console.WriteLine("Objeto Modelo creado e incializado");
}
public string Nombre{
get{ return this.nombre; }
set{ this.nombre=value; }
}
public int Numero{
get{ return this.numero; }
set{ this.numero=value; }
}
}
}
Compilar y ejecutar con:
$ dotnet run
$ dotnet run
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.