TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Matthew Barnett
NA
6
0
Factory methods, Private abstract/interface methods.
Sep 15 2008 3:41 PM
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.
Reply
Answers (
5
)
Attachement
problem in making a browser application