Essays.club - Ensayos gratis, notas de cursos, notas de libros, tareas, monografías y trabajos de investigación
Buscar

Clases Parciales, Inherentes & Estaticas

Enviado por   •  4 de Abril de 2018  •  2.077 Palabras (9 Páginas)  •  258 Visitas

Página 1 de 9

...

{

set

{

lado2 = value;

}

get

{

return lado2;

}

}

}

}

- Archivo2.cs

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace ClaseParcial

{

partial class Rectangulo

{

public int RSup()

{

int sup = Lado1 * Lado2;

return sup;

}

public int RPer()

{

int per = Lado1 * 2 + Lado2 * 2;

return per;

}

}

}

Ejemplo2:

- Main

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace ClaseParcial

{

class Program

{

static void Main(string[] args)

{

Circulo cir = new Circulo();

cir.radio = 5;

cir.diametro = 10;

Console.WriteLine("La superficie del circulo es:" +

cir.RSup());

Console.WriteLine("El perímetro del circulo es:" +

cir.RPer());

Console.ReadKey();

}

}

}

- Archivo1.cs

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace ClaseParcial

{

partial class Circulo

{

private int radio;

public int radio

{

set

{

radio = value;

}

get

{

return radio;

}

}

private int diametro;

public int diametro

{

set

{

diametro = value;

}

get

{

return diametro;

}

}

}

}

- Archivo2.cs

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace ClaseParcial

{

partial class Rectangulo

{

public int RSup()

{

int sup = pi * pow(radio,2);

return sup;

}

public int RPer()

{

int per = pi * diametro;

return per;

}

}

}

Documentación

Son ejemplos bastantes simples donde los dos son muy parecidos ya que la idea es reforzar y ver desde otro punto de vista como se está implementando y así el usuario poder entender lo que se hizo en los ejemplos desarrollados para la clase parcial.

Implementación:

...

Descargar como  txt (17.5 Kb)   pdf (81.1 Kb)   docx (32.1 Kb)  
Leer 8 páginas más »
Disponible sólo en Essays.club