<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Javascript &#8211; public / private Methoden</title>
	<atom:link href="http://schnipsel.davidhellmann.com/html/javascript-public-private-methoden/62/feed" rel="self" type="application/rss+xml" />
	<link>http://schnipsel.davidhellmann.com/html/javascript-public-private-methoden/62</link>
	<description>Code Schnipsel (Snippets) zu Wordpress, PHP, HTML, CSS, jQuery</description>
	<lastBuildDate>Mon, 05 Dec 2011 22:32:45 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Vincent</title>
		<link>http://schnipsel.davidhellmann.com/html/javascript-public-private-methoden/62/comment-page-1#comment-669</link>
		<dc:creator>Vincent</dc:creator>
		<pubDate>Wed, 16 Dec 2009 18:49:41 +0000</pubDate>
		<guid isPermaLink="false">http://schnipsel.davidhellmann.com/?p=62#comment-669</guid>
		<description>Du meinst wohl so:

&lt;pre lang=&quot;php&quot; line=&quot;1&quot;&gt;function bla () {
  var priv  = &quot;privat&quot;;
  this.publicMethod = function () {
    privateMethode();
  }
  var privateMethode = function ()   {
    alert(priv + &quot; &quot; + this.publ);
  }
}
var objekt = new bla();
objekt.publicMethod();&lt;/pre&gt;

Andrenfalls wird die Variable privateMethode n&#228;mlich global und man kann sie per privateMethode(); aufrufen.</description>
		<content:encoded><![CDATA[<p>Du meinst wohl so:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> bla <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">var</span> priv  <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;privat&quot;</span><span style="color: #339933;">;</span>
  this<span style="color: #339933;">.</span>publicMethod <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    privateMethode<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #000000; font-weight: bold;">var</span> privateMethode <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>   <span style="color: #009900;">&#123;</span>
    alert<span style="color: #009900;">&#40;</span>priv <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; &quot;</span> <span style="color: #339933;">+</span> this<span style="color: #339933;">.</span>publ<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">var</span> objekt <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> bla<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
objekt<span style="color: #339933;">.</span>publicMethod<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Andrenfalls wird die Variable privateMethode n&#228;mlich global und man kann sie per privateMethode(); aufrufen.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

