的代碼是在這裏:的Javascript OOP和
Father.js
(function(){
function father(){
};
father.prototype.init = function(){
console.log('father');
}
})()
Child.js
(function(){
function child(){
}
child.prototype.init = function(){
console.log('child');
}
var father = new father();
})()
我有2個問題: 我怎麼能喊爸爸對象或子對象的腳本標記或創建任何第三方JavaScript文件之間? 第二:如何調用子類中的父對象。 我是JS的新手,並在JavaScript中使用OOP時遇到了一些問題。 非常感謝您的幫助
類似'VAR父親=(函數(){...;回報父親}());' – elclanrs
@elclanrs:您應該將其作爲答案發布。 – icktoofay