java - Design Scenario: Smartphone class and will have derived classes like IPhone,AndroidPhone,WindowsMobilePhone can be even phone names with brand -


this 1 of java designing question found on internet. tried solve question per object oriented knowledge.

you have smartphone class , have derived classes iphone,androidphone,windowsmobilephone can phone names brand, how design system of classes? detail mentioned per requirement wise design must flexible enough support future products , stable enough support changes in existing model.

as per understanding if have provide design above question ,then create phone class abstract class.smartphone class subclass of phone class , iphone,androidphone,windowsmobilephone 4 subclasses of smartphone class. there attribute name brand in iphone,androidphone , windowsmobilephone classes support phone names brand. other possible attributes version number, platform, model number,model name etc

please let me know if above design correct or not.i need inputs improve or correct solution.

your design seems fine.

i suggest:

1-> create parent class "smartphone"

2-> can have smartphone must have attributes model,release year, brand.

3-> parent class should include smart phone must have features calling,messaging abstract methods

3-> common smartphone features,you can have interfaces indicates smartphone common features camera,palyer etc

4-> child classes androidphone ,iosphone can inherit smartphone parent class , shall define must have attributes , featuresof smartphone.

5-> child classes can implement common features interfaces , if features spported phone.

6->in future if new smartphone child class created, can inherit smartphone parent class , implement common features via defined interfaces.

7->if in future features need added, new interfaces can designed same , implemented phones support it.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -