Роман Татаринцев
111 повідомлень
#14 років тому


public class People {
private var mother:Woman;
private var father:Man;

public function People(mother:Woman, father:Man) {
this.mother = mother;
this.father = father;
}
public function GetMother():Woman {
return this.mother;
}
public function GetFather():Man {
return this.father;
}
}

public class Woman extends People {
public function Sex(man:Man):People {
if(Math.random() < 0.5)
return new Man(this, man);
else
return new Woman(this, man);
}
}

public class Man extends People {
public function Sex(woman:Woman):People {
return women.Sex(this);
}
}

// Вопрос:
// Как создать два объекта firstMan:Man и firstWoman:Woman
// чтобы потом выполнить операции
// var firstPeople:People = firstWoman.Sex(firstMan);
// var secondPeople:People = firstPeople.GetMother().Sex(firstPeople.GetFather());



Задачу описал на ActionScript, т. к. его осваиваю.
Ответы можно давать и серьезные и не очень =) Но желательно в форме кода.