public override object Clone() { Place clone = new Place(this.Latitude, this.Longitude); Area clone1 = new Area(clone, this.NameOfArea, this.NameOfContinetn, this.CountOfCity, this.SquearOfArea); City clone2 = new City(clone1, this.NameOfCity, this.CountOfPeople, this.SquearOfCity); Megapolice clone3 = new Megapolice(clone2, this.CountOfAglommeration); return(new Address(clone3, this.streatName, this.numberOfStreat)); }
public override bool Equals(object obj) { if (obj == null || GetType() != obj.GetType()) { return(false); } Megapolice p = (Megapolice)obj; return((latitude == p.Latitude) && (longitude == p.Longitude)); }
public Address(Megapolice megapolice, string name, int num) { latitude = megapolice.Latitude; longitude = megapolice.Longitude; nameOfContinetn = megapolice.NameOfContinetn; nameOfArea = megapolice.NameOfArea; countOfCity = megapolice.CountOfCity; squearOfArea = megapolice.SquearOfArea; countOfPeople = megapolice.CountOfPeople; nameOfCity = megapolice.NameOfCity; squearOfCity = megapolice.SquearOfCity; countOfAglommeration = megapolice.CountOfAglommeration; placeSaver = (Place)megapolice.placeSaver.Clone(); streatName = name; numberOfStreat = num; }
public MyCollection(Random Rnd) { int len = Rnd.Next(1, 100); for (int i = 0; i < len; i++) { switch (Rnd.Next(1, 5)) { case 1: Place ad = new Place(Rnd); list.Add(ad); break; case 2: Area add = new Area(Rnd); list.Add(add); break; case 3: City addd = new City(Rnd); list.Add(addd); break; case 4: Megapolice adddd = new Megapolice(Rnd); list.Add(adddd); break; case 5: Address addddd = new Address(Rnd); list.Add(addddd); break; } } numNow = 0; }