Hi ,
I want to implement oops ,let say there exist two different user user1(Accountant)
and user2(client)
Each user should print report on the basis of there roles.(ie
1) Accountant should able to print report with header footer and invoice. And
2 ) Client user should print report without header,footer and invoice).
3) and in future there may come some different requirement.
How to follow oops to accomplished the above task.
I have a plan like below
public inferface IReport
{
void print();
}
public class headerfooterInvoice{
}
class clsAccountant : IReport
{
void header()
{
}
overide print(){
}
void footer()
{}
void invoicereport()
{
}
}
class clsClient : IReport
{
overide print()
{
}
}
class static clsfactory
{
public static IReport getReport(int usertype)
{
IReport objireprt
if(usertyp="1")
{
objireprt=new clsAccountant();
}
else
{
objireprt=new clsClient();
}
return objireprt;
}
}
button click code here
IReport objreprt;
objreprt= clsfactory.getReport(session["usertype"]);
objreprt.print();
how will i call header method,footer method,and invoice method ,
I need some logic in which i dont need to change my client code if in future
there come some different scenarios.
Plz someone guide me which design pattern should i follow .