示例#1
0
        public Child(string name, string gender, Toy toy)
        {
            this.name = name;
            if (gender == "male" || gender == "female")
                this.gender = gender;
            else
                this.gender = new RandomGenerator().RandomGender();
            if (toy != null)
                this.toy = toy;
                hasToy = true;

            if (hasToy)
                isBoring = false;
        }
示例#2
0
        public Child()
        {
            RandomGenerator rand = new RandomGenerator();
            this.gender = rand.RandomGender();
            this.name = rand.RandomName();
            if (new Random().Next(0, 6) > 2)
            {
                this.toy = new Toy();
                hasToy = true;
            }

            if (hasToy)
                isBoring = false;
        }