SHARE
    TWEET
    Guest User

    SO#20630605

    a guest
    Dec 17th, 2013
    138
    0
    Never
    Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
    1. /*
    2. function BaseFunc(x, y) {
    3. this.X = x;
    4. this.Y = y;
    5. }
    6. */
    7. class Base {
    8. public X;
    9. public Y;
    10. function Base(x,y) {
    11. this.X=x;
    12. this.Y=y;
    13. }
    14. }
    15. /*
    16. function DerivedFunc(x, y, z) {
    17. this.Z = z;
    18. BaseFunc.call(this, x, y);
    19. }
    20. DerivedFunc.prototype = new BaseFunc;
    21. DerivedFunc.prototype.sayHello = function () {
    22. alert("Result is: " + (this.X + this.Y + this.Z));
    23. }
    24. */
    25. class Derived : public Base {
    26. public Z;
    27. function Derived(x,y,z)::Base(x,y) {
    28. this.Z=z;
    29. }
    30. function sayHello() {
    31. /* alert */
    32. }
    33. }
    34. /*
    35. function Test() {
    36. var d = DerivedFunc(1, 2, 3);
    37. var b = new BaseFunc(4, 5);
    38. d.sayHello();
    39. b.sayHello();
    40. }
    41. */
    42. var d = new Derived(1,2,3);
    43. var b = new Base(4,5);
    44. d.sayHello();// OK
    45. b.sayHello();//Error
    Advertisement
    Add Comment
    Please, Sign In to add comment
    Public Pastes
    We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
    Not a member of Pastebin yet?
    Sign Up, it unlocks many cool features!

    AltStyle によって変換されたページ (->オリジナル) /