diff --git a/lib/class.js b/lib/class.js index 10c19be..96672b6 100644 --- a/lib/class.js +++ b/lib/class.js @@ -56,6 +56,9 @@ exports.implements = function() for ( var i = 0; i < len; i++ ) { arg = arguments[ i ]; + + // copy all interface methods to the class (does not yet deep copy) + util.propCopy( arg.prototype, dest.prototype ); dest.implemented.push( arg ); } diff --git a/test/test-class-implements.js b/test/test-class-implements.js index 7599e22..9fd605b 100644 --- a/test/test-class-implements.js +++ b/test/test-class-implements.js @@ -63,3 +63,10 @@ assert.ok( "Class contains list of implemented interfaces" ); +assert.ok( + ( ( Foo.prototype.foo instanceof Function ) + && ( Foo.prototype.foo2 instanceof Function ) + ), + "Abstract methods are copied into the new class prototype" +); +