Social Icons

miércoles, 27 de julio de 2022

Bucle for con Arrays

 // See https://aka.ms/new-console-template for more information


Shapefile sh1 = new Shapefile("punto", "UTM Z18S", 1);

Shapefile sh2 = new Shapefile("linea", "UTM Z18S", 2);


Shapefile[] arrayShapefile= new Shapefile[2];


arrayShapefile[0] = sh1;

arrayShapefile[1] = sh2;



for(int i=0;i<=1;i++)

{

    arrayShapefile[i].getShapefile1();

}





class Shapefile

{

    //Propiedades

    string geometria;

    string sistemaref;

    int cantidad;

    //Definición Constructor

    public Shapefile(string geometria, string sistemaref, int cantidad)

    {

        this.geometria = geometria;

        this.sistemaref = sistemaref;

        this.cantidad = cantidad;

    }


    public void getShapefile1()

    {

        Console.WriteLine(geometria);

        Console.WriteLine(sistemaref);

        Console.WriteLine(cantidad);


    }




}


No hay comentarios.:

Publicar un comentario

PELICULAS PARA VER

  Inexactitudes fácticas en las películas (msn.com) https://www.msn.com/es-co/entretenimiento/famosos/inexactitudes-f%C3%A1cticas-en-las-pel...

 
 
Blogger Templates