Hey guys
I've got a Factory that can return a database writing object. It takes in a config file that points it to which class to create an object of. Now this is were I'm stuck.
Factory -> returns a database writter
now there's more than 1 way of writing a database writter. In my case I wish to create a databasewritter than will write to a live database and another class that will write to a text file.
Here's a more simplistic idea:
Interface databaseWritter:
String writeMsg(String msg)
public class MessageOne : databaseWritter
{
public string writeMsg(String msg)
{
//INSERT INTO DATABASE....
return "This is a message from Implementation1";
}
}
Implementation2:
public class MessageTwo : databaseWritter
{
public string message()
{
//WRITE TO FILE....
return "This is a message from Implementation2";
}
}
How would I go about coding such behaviour?