Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

The Science of Programming/SwayPresentations/Objects/ClassAndObjectComponents2

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

Class and Object Components, continued Here's an attempt... var z = { var z_shared = { var count = 0; this; }; function z() { var shared = z_shared; var count = 0; shared . count += 1; count += 1; this; } }; function x() { extends(z()); } Testing... inspect(x() . shared . count); inspect(x() . count); inspect(x() . shared . count); Output is as desired: x() . shared . count is 1 x() . count is 1 x() . shared . count is 3 The beauty of concatenation...