Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- function BaseFunc(x, y) {
- this.X = x;
- this.Y = y;
- }
- */
- class Base {
- public X;
- public Y;
- function Base(x,y) {
- this.X=x;
- this.Y=y;
- }
- }
- /*
- function DerivedFunc(x, y, z) {
- this.Z = z;
- BaseFunc.call(this, x, y);
- }
- DerivedFunc.prototype = new BaseFunc;
- DerivedFunc.prototype.sayHello = function () {
- alert("Result is: " + (this.X + this.Y + this.Z));
- }
- */
- class Derived : public Base {
- public Z;
- function Derived(x,y,z)::Base(x,y) {
- this.Z=z;
- }
- function sayHello() {
- /* alert */
- }
- }
- /*
- function Test() {
- var d = DerivedFunc(1, 2, 3);
- var b = new BaseFunc(4, 5);
- d.sayHello();
- b.sayHello();
- }
- */
- var d = new Derived(1,2,3);
- var b = new Base(4,5);
- d.sayHello();// OK
- b.sayHello();//Error
Advertisement
Add Comment
Please, Sign In to add comment