www.webdeveloper.com
Results 1 to 3 of 3

Thread: changing default constructor

  1. #1
    Join Date
    Jan 2007
    Posts
    10

    changing default constructor

    I have this:

    PHP Code:
    function foo() {
        
    alert'default constructor' ) ;
        
    // methods and properties
    }

    function 
    bar() {
        
    alert'new constructor' ) ;
    }

    foo.prototype.constructor bar ;

    new 
    foo() ; 
    I wanna change the default constructor with new constructor, leaving all foo's methods and properties unchanged, but when create a new instance of foo, still alert 'default constructor'... what's wrong?

  2. #2
    Join Date
    Apr 2007
    Location
    NY
    Posts
    58
    Maybe:
    PHP Code:
    foo.prototype.constructor bar(); 

  3. #3
    Join Date
    Jan 2007
    Posts
    10
    no... bar() executes the funcion bar

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles