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

Make the CreatePizza method in SimplePizzaStoreBase protected and obviously don't expose it to customers. #15

Open
moslemkh opened this issue Jul 18, 2024 · 0 comments

Comments

@moslemkh
Copy link

moslemkh commented Jul 18, 2024

I think the access modifier of the CreatePizza method in SimplePizzaStoreBase should be changed to protected because only the concrete classes of SimplePizzaStoreBase should be aware of it. In other words, we shouldn't expose CreatePizza to customers who come to the pizza store to order pizza. Therefore, it should be changed to:

protected abstract IPizza CreatePizza(PizzaTypeEnum pizzaType);

And obviously, in their concrete classes:

protected override IPizza CreatePizza(PizzaTypeEnum pizzaType)
=> _factory.CreatePizza(pizzaType);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant