Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class EventStoreInterface{
- // this will be our virtual class
- // it will contains abstract functions/methods addOccation, checkOccation, etc
- }
- class CSVEventStore: public EventStoreInterface{
- // We have inherited EventStoreInterface
- // Here we have implementation of functions like addOccation, checkOccation, etc specifically for CSV
- }
- class XMLEventStore: public EventStoreInterface{
- // We have inherited EventStoreInterface
- // Here we have implementation of functions like addOccation, checkOccation, etc specifically for XML
- }
- // Now the main function would look something like this
- int main(int argc, char *argv[])
- {
- if(argv[1] == "xml")
- {
- EventStoreInterface Event = new XMLEventStore;
- }
- if(argv[1] == "csv")
- {
- EventStoreInterface Event = new CSVEventStore;
- }
- /* Now we will pass the "Event" to our gui(MainWindow) and will call the methods of it, which will hide whether the method of XMLEventStore is called or of CSVEventStore.
- */
- }
- // This type of implementation will hide the data storage from the rest of the application. The business layer / UI also will not know which backend is used.
Add Comment
Please, Sign In to add comment