Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- function Zviera() {
- this.meno = "Zviera";
- this.toString = function () {
- return "Moje meno je: " + this.meno;
- };
- }
- function PsoviteSelmy() {
- this.meno = "Psovite selmy";
- }
- function Vlk() {
- this.meno = "Vlk";
- }
- PsoviteSelmy.prototype = new Zviera();
- Vlk.prototype = new PsoviteSelmy();
- PsoviteSelmy.prototype.constructor = PsoviteSelmy;
- Vlk.prototype.constructor = Vlk;
- var arktickyVlk = new Vlk();
- document.write(arktickyVlk.toString() + "<br />");
- document.write("Je arkticky vlk vlkom: " + (arktickyVlk instanceof Zviera) + "<br />");
- Zviera.prototype.zvuk = "Grrrrr";
- Zviera.prototype.getZvuk = function () {
- return "Je to: " + this.meno + " a robi: " + this.zvuk;
- };
- PsoviteSelmy.prototype.zvuk = "Haf";
- Vlk.prototype.zvuk = "Grrr haf";
- document.write(arktickyVlk.getZvuk() + "<br />");
Advertisement
Add Comment
Please, Sign In to add comment