1
0
Fork 0
easejs/scripts/ex/class-abstract.js

24 lines
577 B
JavaScript

var Database = AbstractClass( 'Database',
{
'public connect': function( user, pass )
{
if ( !( this.authenticate( user, pass ) ) )
{
throw Error( "Authentication failed." );
}
},
// abstract methods define arguments as an array of strings
'abstract protected authenticate': [ 'user', 'pass' ],
} );
var MongoDatabase = Class( 'MongoDatabase' )
.extend( Database,
{
// must implement each argument for Database.authenticate()
'protected authenticate': function( user, pass )
{
// ...
},
} );