Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] Using Polymorphism to Simplify Object Storage in Canvas #16

Open
Tracked by #2
1chooo opened this issue Jun 14, 2024 · 0 comments
Open
Tracked by #2
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@1chooo
Copy link
Owner

1chooo commented Jun 14, 2024

Since all the objects inherit from Shape, we can use polymorphism to store all the objects in a single shapes list, instead of separating them into shapes and lines.

private List<Shape> shapes = new ArrayList<Shape>();
// private List<Line> lines = new ArrayList<Line>(); // This can be removed

private List<Shape> shapes = new ArrayList<Shape>();
private List<Line> lines = new ArrayList<Line>();

@1chooo 1chooo added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Jun 14, 2024
@1chooo 1chooo self-assigned this Jun 14, 2024
@1chooo 1chooo linked a pull request Jun 16, 2024 that will close this issue
@alexeyleping alexeyleping mentioned this issue Jun 18, 2024
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant