Re: "with" statement, extending prototype
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Re: "with" statement, extending prototype

From: Luke Matuszewski <matuszewski.lukasz@gmail.com>
Date: Wed Apr 05 2006 - 21:58:59 CEST

eman1000@gmail.com napisal(a):
> var Car = function() {}
> with(Car.prototype) {
> function start() {
> alert('starting');
> }
> }

Here is self explanatory example of public/protected paradigim:

function Car() {
  function privateFunction()
  {

  }

  this.publicFunction = function()
  {

  };
}

Car.staticConstructorFunction = function()
{

};

Car.prototype.sharedByAllCarObjectsFunction = function()
{

};

var car1 = new Car();

Car.prototype.start();
car1.start();

, still you can read about it here:

http://jibbering.com/faq/faq_notes/closures.html
http://www.litotes.demon.co.uk/js_info/private_static.html
http://www.crockford.com/javascript/private.html
http://www.crockford.com/javascript/inheritance.html

Greets
Luke M.
Received on Mon May 1 04:43:29 2006