Link to home
Start Free TrialLog in
Avatar of rgb192
rgb192Flag for United States of America

asked on

why is it wrong to combine interface and abstract class; acquire the method externally?

interface printer{
  printToScreen(){}
  printToPrinter(){}
 printToCellPhone(){}
 sendToFax(){}
}



computer implements printer
cableBox tv box implements printer
cable router implements router


all 3 of these classes must print
may be easier to create abstract class than to keep on creating new methods and copy pasting those methods into all classes

abstract class AllPrintingMehods(){
 printToScreen(){}
  printToPrinter(){}
 printToCellPhone(){}
 sendToFax(){}

}




why is it wrong to combine interface and abstract class

why is wrong to acquire the method externally?
SOLUTION
Avatar of gurpsbassi
gurpsbassi
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of Subrat (C++ windows/Linux)
Subrat (C++ windows/Linux)
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial