Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class CompositeFigure {
- public Figure[] figures;
- public CompositeFigure(int size) {
- figures = new Figure[size];
- }
- public void draw() {
- for(Figure figure : figures) {
- figure.draw();
- }
- }
- }
- class Activity {
- public static void main(String[] str) {
- CompositeFigure figure = new CompositeFigure(2);
- figure.figures[0] = new Circle();
- figure.figures[1] = new Rectangle();
- figure.draw();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement