Factory methods, Private abstract/interface methods.
Ok, i think my head is about to explode.
I'm trying to create a framework for a couple of applications that i'm rewriting from vb6. I've read a little bit about factory design patterns and decided i'd try and implement it.
I have created a business entity and given it a private constructor (So no myObject m = new myObject()) i've also given it a static CreateObject method to create new instances.
What i would like to do is build as much functionality (Such as logging and security) into a base class and have my other business objects automatically inherit that functionality without the need to program it into my derived classes. The only way i could think to do it was :-
employee emp = employee.CreateEmployee();
emp.setfieldvalues.....
emp.Update.
Upon calling emp.Update (Which incidently is a public method in the base class), a log file will be updated saying that the record was being updated, then call a private method called UpdateMe (using reflection) on the employee which would then actually write the record to the database.
Now i'm not sure that any of that even makes sense and it wouldn't supprise me if it was bad programming practice. If it is acceptible to do this, is there a way a forcing my derrived classes to implement the private method UpdateMe ?
Anyone?? Anyone??
Thanks.