Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hiii
i m designing expert system which detect errors in frames(classes).i have 3 layerd architecture..business layer is base class..ZipCode,SSN,Name etc are derived classes(frames)..there is a virtual method in Base Class e.g Check_Format(which match the frame(zipcode,ssn etc)value(save in database table)with regular expression)and that method is overrides in derived class..

now i just want that e.g if ZipCode value matches with regular expression then the ZipCode frame invoke and if SSn value matches then SSn invoke automatically..i donot want any hardcoding every thing i want is dynamic..
soo plz helppp mee
thanks in advance
Posted
Comments
Toli Cuturicu 6-Apr-11 3:10am    
Not clear.
dooa 6-Apr-11 3:33am    
how to switch between classes..if i want to detect errorin ZipCode Class then Zipcode class will be activates..

all i m doing is there is table in database in which frames names(classes) are saved with regular expression..and also there is another table of patient in database with frames(SSn ,ZipCode etc) values..
now i m doing is take value from patient table and match this with regular expression of that frame.in order to do this i want to to activate the classs whoz regular expression matches with its values in database.
keep in mind that classes are the frames because this is Frame based system soo donot be confuse with frames and classes.
dooa 7-Apr-11 3:43am    
i donot want to invoke methods automatically .i just want to invoke a class,because every class contain a overrided method of check_format..soo if i want to match regular expression of zipcode then zipcode frames activate and execute the check_format method...
soo just tell me how to switch between classes..
i just want that if i want to execute method of two classes,then only two classes will invoke..remaining classes behave like silent

just have a factory and then in the factory method pass your regex pattern.The Check_format should be static method. So the factory method call each type's check_format method if results true then it give out the instance of that type of class.

But there may be a problem. How the caller know which type of object it is going to get?. The factory can produce a type of the parent, but holds actual instance of a child of a specific type. In that case the parent need to have all the methods (may be abstract) which a child need to have. Then the factory returns a type of the parent but holds instance of the child. All the methods necessary will be available through the parent class. An interface would be ideal in this case.
 
Share this answer
 
Your quetion ins't all that clear, but if you want to call a base method or an overridden method from the base class itself, use this:

C#
this.MethodName();


If you want to use the overriden method from the base class, use this:

C#
MethodName();
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900