请输入您要查询的俚语:

 

俚语 object-oriented masturbation
释义

object-oriented masturbation

the stimulation or manipulation of one’s own ego by way of using object-oriented code in places where it has no advantage instead resulting in unnecessary complication and bloat.
Objective: Sum two numbers and print the result in the format “The answer is: X” where X is the sum of the two numbers:

Object-oriented masturbation solution:

function MathLib(){

this.answer = null;
}

MathLib.prototype.sum = function (x,y){

this.answer = x + y;
}

MathLib.prototype.getAnswer = function(){

return this.answer;
}

function Printer(){

this.preText = ”;
}

Printer.prototype.setPreText = function(str){

this.preText = str;
}

Printer.prototype.out = function (str){

document.write(this.preText + str);
}

// To run
var math = new MathLib();
var print = new Printer();
math.sum(1,1);
print.setPreText(‘The answer is: ‘);
print.out(math.answer);
随便看

 

英语俚语辞典收录了3210630条英语俚语在线翻译词条,基本涵盖了全部常用英语俚语的翻译及用法,是英语学习的有利工具。

 

Copyright © 2000-2023 Newdu.com.com All Rights Reserved
更新时间:2024/9/20 6:50:09