diff options
author | Ryan Johnson <rjohnson@mozilla.com> | 2021-04-29 16:16:42 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-29 16:16:42 -0700 |
commit | 95aca4b4d8fa62815d4bd412fff1a364f842814a (patch) | |
tree | 5e57661720fe9058d5c7db637e764800b50f9060 /files/it/web/javascript/reference/classes/constructor | |
parent | ee3b1c87e3c8e72ca130943eed260ad642246581 (diff) | |
download | translated-content-95aca4b4d8fa62815d4bd412fff1a364f842814a.tar.gz translated-content-95aca4b4d8fa62815d4bd412fff1a364f842814a.tar.bz2 translated-content-95aca4b4d8fa62815d4bd412fff1a364f842814a.zip |
remove retired locales (#699)
Diffstat (limited to 'files/it/web/javascript/reference/classes/constructor')
-rw-r--r-- | files/it/web/javascript/reference/classes/constructor/index.html | 162 |
1 files changed, 0 insertions, 162 deletions
diff --git a/files/it/web/javascript/reference/classes/constructor/index.html b/files/it/web/javascript/reference/classes/constructor/index.html deleted file mode 100644 index 49c7fc05cd..0000000000 --- a/files/it/web/javascript/reference/classes/constructor/index.html +++ /dev/null @@ -1,162 +0,0 @@ ---- -title: costruttore -slug: Web/JavaScript/Reference/Classes/constructor -translation_of: Web/JavaScript/Reference/Classes/constructor -original_slug: Web/JavaScript/Reference/Classes/costruttore ---- -<div>{{jsSidebar("Classes")}}</div> - -<p>Il metodo <code>constructor</code> è un metodo speciale usato per la creazione e l'inizializzazione di un oggetto creato da una <code>classe</code>.</p> - -<h2 id="Sintassi">Sintassi</h2> - -<pre class="syntaxbox">constructor([argomenti]) { ... }</pre> - -<h2 id="Descrizione">Descrizione</h2> - -<p>In una classe ci può essere un solo metodo con il nome "constructor". Se una classe contiene una o più occorrenze del metodo <code>constructor</code> viene sollevato un errore di tipo {{jsxref("SyntaxError")}}. </p> - -<p>Un costruttore può usare la keyword <code>super</code> per chiamare il costruttore di una classe genitore.</p> - -<p>Se non viene specificato un metodo <code>constructor</code>, verrà usato quello di default.</p> - -<h2 id="Esempi">Esempi</h2> - -<h3 id="Usare_il_metodo_constructor">Usare il metodo <code>constructor</code></h3> - -<p>Questo pezzo di codice è stato preso da <a href="https://github.com/GoogleChrome/samples/blob/gh-pages/classes-es6/index.html">classes sample</a> (<a href="https://googlechrome.github.io/samples/classes-es6/index.html">live demo</a>).</p> - -<pre class="brush: js">class Square extends Polygon { - constructor(length) { - // Chiama il costruttore della classe padre usando lo stesso valore length - // come altezza e come larghezza del Poligono - super(length, length); - // Nota: Nelle classi derivate, super() deve essere chiamato prima - // dell'utilizzo di 'this', altrimenti viene sollevato un reference error. - this.name = 'Square'; - } - - get area() { - return this.height * this.width; - } - - set area(value) { - this.area = value; - } -}</pre> - -<h3 id="Costruttori_predefinito">Costruttori predefinito</h3> - -<p>Se non viene specificato un metodo costruttore, verrà usato quello di default. Per le classi base il costruttore di default è:</p> - -<pre class="brush: js">constructor() {} -</pre> - -<p>Per le classi derivate invece è:</p> - -<pre class="brush: js">constructor(...args) { - super(...args); -}</pre> - -<h2 id="Specifiche">Specifiche</h2> - -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">Specifica</th> - <th scope="col">Stato</th> - <th scope="col">Commento</th> - </tr> - <tr> - <td>{{SpecName('ES6', '#sec-static-semantics-constructormethod', 'Constructor Method')}}</td> - <td>{{Spec2('ES6')}}</td> - <td>Initial definition.</td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-static-semantics-constructormethod', 'Constructor Method')}}</td> - <td>{{Spec2('ESDraft')}}</td> - <td> </td> - </tr> - </tbody> -</table> - -<h2 id="Compatibilità_con_i_Browser">Compatibilità con i Browser</h2> - -<p>{{CompatibilityTable}}</p> - -<div id="compat-desktop"> -<table class="compat-table"> - <tbody> - <tr> - <th>Specifica</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Supporto Base</td> - <td>{{CompatChrome(42.0)}}</td> - <td>{{CompatGeckoDesktop(45)}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - </tr> - <tr> - <td>Costruttore predefinito</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatGeckoDesktop(45)}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - </tr> - </tbody> -</table> -</div> - -<div id="compat-mobile"> -<table class="compat-table"> - <tbody> - <tr> - <th>Specifica</th> - <th>Android</th> - <th>Android Webview</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - <th>Chrome per Android</th> - </tr> - <tr> - <td>Supporto Base</td> - <td>{{CompatNo}}</td> - <td>{{CompatChrome(42.0)}}</td> - <td>{{CompatGeckoMobile(45)}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatChrome(42.0)}}</td> - </tr> - <tr> - <td>Costruttore predefinito</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatGeckoMobile(45)}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - </tr> - </tbody> -</table> -</div> - -<h2 id="Vedi_anche">Vedi anche</h2> - -<ul> - <li><a href="/en-US/docs/Web/JavaScript/Reference/Operators/super">super()</a></li> - <li><a href="/en-US/docs/Web/JavaScript/Reference/Operators/class"><code>class</code> expression</a></li> - <li><a href="/en-US/docs/Web/JavaScript/Reference/Statements/class"><code>class</code> declaration</a></li> - <li><a href="/en-US/docs/Web/JavaScript/Reference/Classes">Classes</a></li> -</ul> |