The problem with most computer science texts is the examples aren't interesting. Polymorphism isn't really hard to understand, but the examples are usually boring or difficult to understand. This is an alternative text which attempts to use a problem space that's already familiar to the college student to make the concepts of programming simple.
Polimorfismo
Colapsar
X
-
sssssta biennnnnnnn!
Código PHP:class Pussy extends Hole {} class Mouth extends Hole {} class Ass extends Hole {} class Penis { public Fuck(Hole h) { while(!this.isSpent) { h.TakeAThrust(this); this.arousal++; } h.TakeALoad(this.load); } } abstract class Hole { public abstract void TakeAThrust(Penis p); public abstract void TakeALoad(Load l); } public void TakeAThrust(Penis p) { if(!enoughLube && p.Circumference > 6) { analFissureCount++; } } //in Pussy public void TakeALoad(Load l) { //randomly determine whether to cause a pregnancy with a 10% chance... if(Math.RandomNumber() % 10 == 0) { this.Woman.EggFactory.GetEgg().Inseminate(l); } } //in Mouth public void TakeALoad(Load l) { //50-50 chance of spitting or swallowing if(Math.RandomNumber() % 1 == 0) { this.Spit(l); } else { this.Swallow(l); } } //create an array of 4 women Woman[] women = new Woman[]{new Woman(), new Woman(), new Woman(), new Woman()}; //create a hole array to reference the holes of all 4 women, plus two additional holes. Hole[] holes = new Hole[4*3 + 2]; for(int i = 0; i < women.Length; i++) { holes[3 * i + 0] = women[i].Mouth; holes[3 * i + 1] = women[i].Pussy; holes[3 * i + 2] = women[i].Ass; } //additional holes (so the faggy programmers don't feel left out) Man m = new Man(); holes[12] = m.Mouth; holes[13] = m.Ass; //now we loop through the holes and fuck them all with the same Penis Penis p = new Man().Penis; foreach(Hole h in holes) { p.Fuck(h); }

Comentario
-
-


Comentario