File tree Expand file tree Collapse file tree 5 files changed +7
-5
lines changed
Expand file tree Collapse file tree 5 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ var Beverage = function()
33 this . sDescription = 'Unknown beverage' ;
44} ;
55Beverage . prototype . getDescription = function ( ) {
6- return this . sDescription ;
6+ throw new Error ( "This method must be overwritten!" ) ;
77} ;
88Beverage . prototype . cost = function ( )
99{
Original file line number Diff line number Diff line change @@ -2,7 +2,4 @@ var CondimentDecorator = function()
22{
33 Beverage . apply ( this ) ;
44} ;
5- CondimentDecorator . prototype . getDescription = function ( )
6- {
7- throw new Error ( "This method must be overwritten!" ) ;
8- } ;
5+ CondimentDecorator . prototype = new Beverage ( ) ;
Original file line number Diff line number Diff line change 11var Expresso = function ( )
22{
3+ Beverage . apply ( this ) ;
34 this . sDescription = 'Expresso' ;
45} ;
6+ Expresso . prototype = new Beverage ( ) ;
57Expresso . prototype . cost = function ( )
68{
79 return 1.99 ;
Original file line number Diff line number Diff line change 11var HouseBlend = function ( )
22{
3+ Beverage . apply ( this ) ;
34 this . sDescription = 'House Blend coffe' ;
45} ;
6+ HouseBlend . prototype = new Beverage ( ) ;
57HouseBlend . prototype . cost = function ( )
68{
79 return 0.89 ;
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ var Mocha = function(oBeverage)
33 CondimentDecorator . apply ( this ) ;
44 this . oBeverage = oBeverage ;
55} ;
6+ Mocha . prototype = new CondimentDecorator ( ) ;
67Mocha . prototype . getDescription = function ( )
78{
89 return this . oBeverage . getDescription ( ) + ", Mocha" ;
You can’t perform that action at this time.
0 commit comments