Answer the question
In order to leave comments, you need to log in
Storing a value inside a method. Good or bad?
Hello!
Suddenly I asked this question: let's say we have a base class of the following form:
class A
{
public function isDisplayable()
{
return true;
}
}
class B extends A
{
}
class C extends A
{
public function isDisplayable()
{
return false;
}
}
Answer the question
In order to leave comments, you need to log in
A neat example of "Replace Conditional with Polymorphism" from M. Fowler's Refactoring.
Yes, it's appropriate.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question