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/extends | |
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/extends')
-rw-r--r-- | files/it/web/javascript/reference/classes/extends/index.html | 175 |
1 files changed, 0 insertions, 175 deletions
diff --git a/files/it/web/javascript/reference/classes/extends/index.html b/files/it/web/javascript/reference/classes/extends/index.html deleted file mode 100644 index ccf0cab627..0000000000 --- a/files/it/web/javascript/reference/classes/extends/index.html +++ /dev/null @@ -1,175 +0,0 @@ ---- -title: extends -slug: Web/JavaScript/Reference/Classes/extends -translation_of: Web/JavaScript/Reference/Classes/extends ---- -<div>{{jsSidebar("Classi")}}</div> - -<p>La parola chiave <strong>extends</strong> è utilizzata nella <a href="/en-US/docs/Web/JavaScript/Reference/Statements/class">dichiarazione</a> o <a href="/en-US/docs/Web/JavaScript/Reference/Operators/class">espressione</a> di classe per creare una classe figlia di un'altra classe.</p> - -<h2 id="Sintassi">Sintassi</h2> - -<pre class="syntaxbox">class ChildClass extends ParentClass { ... } - -/** -*@desc La classe ChildClass estende la classe ParentClass -*/ -</pre> - -<h2 id="Descrizione">Descrizione</h2> - -<p>La parola chiave <code>extends</code> può essere utilizzata per creare una sottoclasse personalizzata basandosi su classi già esistenti e anche su oggetti nativi (cfr. <a href="en-US/docs/Web/JavaScript/Reference/Global_Objects/Date">Date</a> object).</p> - -<p>Il <code>.prototype</code> dell'estensione deve essere un {{jsxref("Object")}} oppure {{jsxref("null")}}.</p> - -<h2 id="Esempi">Esempi</h2> - -<h3 id="Utilizzare_extends">Utilizzare <code>extends</code></h3> - -<p>Il primo esempio crea una classe chiamata <code>Square</code> dalla classe chiamata <code>Polygon</code>. Questo esempio è estratto da questo <a href="https://github.com/GoogleChrome/samples/blob/gh-pages/classes-es6/index.html">demo live (sorgente)</a>.</p> - -<p> </p> - -<pre class="brush: js">class Square extends Polygon { - constructor(length) { - // Qui chiama il constructor della classe che estende (parent) - // con le misure per la larghezza e altezza del poligono - super(length, length); - // Nota: In classi derivate, super() deve essere chiamato prima - // di poter utilizzare 'this', altrimenti causerà un errore di reference. - this.name = 'Square'; - } - - get area() { - return this.height * this.width; - } - - set area(value) { - this.height = this.width = Math.sqrt(value); - this.area = value; - } -}</pre> - -<h3 id="Utilizzare_extends_con_oggetti_nativi">Utilizzare <code>extends</code> con oggetti nativi</h3> - -<p>Questo esempio estende l'oggetto nativo {{jsxref("Date")}}. Questo esempio è estratto da questo <a href="https://github.com/GoogleChrome/samples/blob/gh-pages/classes-es6/index.html">demo live (sorgente)</a>.</p> - -<pre class="brush: js">class myDate extends Date { - constructor() { - super(); - } - - getFormattedDate() { - var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; - return this.getDate() + '-' + months[this.getMonth()] + '-' + this.getFullYear(); - } -}</pre> - -<h3 id="Estendere_null">Estendere <code>null</code></h3> - -<p>Estendere da {{jsxref("null")}} funziona come di norma, eccetto che l'oggetto prototipo non eredita da {{jsxref("Object.prototype")}}.</p> - -<pre class="brush: js">class nullExtends extends null { - constructor() {} -} - -Object.getPrototypeOf(nullExtends); // Function.prototype -Object.getPrototypeOf(nullExtends.prototype) // null</pre> - -<h2 id="Specificazioni">Specificazioni</h2> - -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">Specification</th> - <th scope="col">Status</th> - <th scope="col">Comment</th> - </tr> - <tr> - <td>{{SpecName('ES2015', '#sec-class-definitions', 'extends')}}</td> - <td>{{Spec2('ES2015')}}</td> - <td>Initial definition.</td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-class-definitions', 'extends')}}</td> - <td>{{Spec2('ESDraft')}}</td> - <td> </td> - </tr> - </tbody> -</table> - -<h2 id="Compatibilità_Browser">Compatibilità Browser</h2> - -<p>{{CompatibilityTable}}</p> - -<div id="compat-desktop"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatChrome(42.0)}}</td> - <td>{{CompatGeckoDesktop(45)}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - </tr> - <tr> - <td>Array subclassing</td> - <td>{{CompatChrome(43.0)}}</td> - <td>{{CompatNo}}</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>Feature</th> - <th>Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - <th>Chrome for Android</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatNo}}</td> - <td>{{CompatGeckoMobile(45)}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatChrome(42.0)}}</td> - </tr> - <tr> - <td>Array subclassing</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatChrome(43.0)}}</td> - </tr> - </tbody> -</table> -</div> - -<h2 id="Vedi_anche">Vedi anche</h2> - -<ul> - <li><a href="/en-US/docs/Web/JavaScript/Reference/Classes">Classes</a></li> - <li><a href="/en-US/docs/Web/JavaScript/Reference/Operators/super">super</a></li> -</ul> |