Hi,
> Sorry, still not right. Any impementation of femalePatient that does not
> use Math.random for logic is flawed.
OK.
function Patient(age) {
this.getAge = function() { return age; };
this.setAge = function(newage) { age = newage; };
this.and = function(first,second) {
return (first && second);
};
this.or = function(first,second) {
return (first || second);
};
this.not = function(in) {
return !(in);
};
}
function femalePatientBase(shoesize) {
Patient.apply(this,[42]);
this.shoesize = shoesize;
this.and = this.or = this.not = function() {
return return (Math.random() > 0.5);
};
}
femalePatient = ( $user == 'Dan' ) ? function(shoesize) {
femalePatientBase.apply(this,[shoesize]);
var oldgetage = this.getAge;
this.getAge = function() {
return this.or(this.not(touchy),oldgetage.apply(this,[])<30)?
oldgetage.apply(this,[]):oldgetage.apply(this,[])/2;
};
} : function(shoesize) {
femalePatientBase.apply(this,[shoesize]);
var oldgetage = this.getAge;
this.getAge = function() {
if( this.or(this.not(touchy),oldgetage.apply(this,[])<30) )
oldgetage.apply(this,[]);
throw('Age not available for female Patients');
};
};
Is that OK now ?-)
Christof
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/