Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function mybase() {
- var that = {};
- var c = 0;
- that.hi = function() {
- var ele = $('<div></div>');
- ele.html(c++);
- $('body').append(ele);
- }
- return that;
- }
- function myextended() {
- var that = mybase();
- that.hi();
- return that;
- }
- myextended.prototype = new mybase();
- $(document).ready(function() {
- var a = myextended();
- var b = myextended();
- })
- function myextended() {
- mybase.call(this); // apply the parent's constructor on the new object
- this.hi();
- }
- myextended.prototype = Object.create(mybase.prototype);
- function mybase() {
- this.hi = function() {
- var ele = $('<div></div>');
- ele.html(this.c++);
- $('body').append(ele);
- }
- }
- mybase.prototype.c = 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement