Advertisement
snake5

Object-oriented SGScript - inheritance

Jan 19th, 2013
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var printerIface =
  2. {
  3.     print_stdout = function( text ){ print( text ); },
  4. };
  5. var postfixPrinterIface =
  6. {
  7.     print = function( this, text ){ this.print_stdout( text $ this.postfix ); },
  8.     postfix = '[postfix]',
  9. };
  10. var questionPrinter = class( { postfix = '?' }, class( postfixPrinterIface, printerIface ) );
  11. questionPrinter.print( "wat" );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement