package liu.facade.demo;
public class Fund {
Stock1 gu1;
Stock2 gu2;
Stock3 gu3;
NationalDebt1 nd1;
Realty1 rt1;
public Fund(){
gu1 = new Stock1();
gu2 = new Stock2();
gu3 = new Stock3();
nd1 = new NationalDebt1();
rt1 = new Realty1();
}
public void sell(){
gu1.sell();
gu2.sell();
gu3.sell();
nd1.sell();
rt1.sell();
}
public void buy(){
gu1.buy();
gu2.buy();
gu3.buy();
nd1.buy();
rt1.buy();
}
public static void main(String[] args) {
Fund jijin = new Fund();
jijin.buy();
jijin.sell();
Stock2 gu2;
Stock3 gu3;
NationalDebt1 nd1;
Realty1 rt1;
public Fund(){
gu1 = new Stock1();
gu2 = new Stock2();
gu3 = new Stock3();
nd1 = new NationalDebt1();
rt1 = new Realty1();
}
public void sell(){
gu1.sell();
gu2.sell();
gu3.sell();
nd1.sell();
rt1.sell();
}
public void buy(){
gu1.buy();
gu2.buy();
gu3.buy();
nd1.buy();
rt1.buy();
}
public static void main(String[] args) {
Fund jijin = new Fund();
jijin.buy();
jijin.sell();
}
}
--------------------------------------
package liu.facade.demo;
--------------------------------------
package liu.facade.demo;
public class Stock1 {
public void sell(){
System.out.println("stock1 sell");
}
public void buy(){
System.out.println("stock1 buy");
}
}
System.out.println("stock1 sell");
}
public void buy(){
System.out.println("stock1 buy");
}
}
class Stock2{
public void sell(){
System.out.println("stock2 sell");
}
public void buy(){
System.out.println("stock2 buy");
}
}
public void sell(){
System.out.println("stock2 sell");
}
public void buy(){
System.out.println("stock2 buy");
}
}
class NationalDebt1{
public void sell(){
System.out.println("NationalDebt1 sell");
}
public void buy(){
System.out.println("NationalDebt1 buy");
}
}
class Realty1{
public void sell(){
System.out.println("Realty1 sell");
}
public void buy(){
System.out.println("Realty1 buy");
}
}
public void sell(){
System.out.println("Realty1 sell");
}
public void buy(){
System.out.println("Realty1 buy");
}
}
class Stock3{
public void sell(){
System.out.println("stock3 sell");
}
public void buy(){
System.out.println("stock3 buy");
}
}
public void sell(){
System.out.println("stock3 sell");
}
public void buy(){
System.out.println("stock3 buy");
}
}