コード例 #1
0
        public Mammalia(Mammalia oldObj) // конструктор копирования
        {
            this.multicellular = oldObj.multicellular;
            this.aerobe        = oldObj.aerobe;
            this.dioecious     = oldObj.dioecious;
            this.phylum        = oldObj.phylum;
            this.classis       = oldObj.classis;
            this.species       = oldObj.species;
            this.weight        = oldObj.weight;
            this.habitat       = new string[4];
            int haLn = oldObj.habitat.Length;

            if (haLn > 4)
            {
                for (int i = 0; i < 4; i++)
                {
                    this.habitat[i] = oldObj.habitat[i];
                }
            }
            else if (haLn > 0)
            {
                for (int i = 0; i < haLn; i++)
                {
                    this.habitat[i] = oldObj.habitat[i];
                }
                for (int i = haLn; i < 4; i++)
                {
                    this.habitat[i] = "Not defined";
                }
            }
        }
コード例 #2
0
 public createNewMammaliaDialog(Mammalia mam)
 {
     this.mam         = mam;
     multicellularDlg = mam.Multicellular;
     aerobeDlg        = mam.Aerobe;
     dioeciousDlg     = mam.Dioecious;
     phylumDlg        = mam.Phylum;
     classisDlg       = mam.Classis;
     speciesDlg       = mam.Species;
     weightDlg        = mam.Weight;
     habitatDlg1      = mam[0];
     habitatDlg2      = mam[1];
     habitatDlg3      = mam[2];
     habitatDlg4      = mam[3];
     InitializeComponent();
 }