Hi K. Tsang,
I was a bit unclear in my explanation. I meant if a program is used to
test automatically your program and program contains coding like this
This program will not compile when Data is abstract class, but also not compile when you have a singleton, because Data.getInstance() should be invoked to get an instance.
The reason why i would make my data abstract and have a concrete RoomData has to do with making the Data a generic data access class which could be used to handle a file with rooms (through the RoomData, which has a speific check for eg. magic cookie and in future maybe also some other specific implementations of Data methods), but could also handle easily a file with customers (through a new concrete CustomerData class extending from Data). So it would become very easy to handle a similar file as the database file with hotel rooms
Kind regards,
Roel