Is this bad Object Oriented Design? (derived class used in base class)
Posted
by Earlz
on Stack Overflow
See other posts from Stack Overflow
or by Earlz
Published on 2010-05-14T00:48:16Z
Indexed on
2010/05/14
0:54 UTC
Read the original article
Hit count: 269
Hello, Can someone tell me if this class structure is bad?
class abstract Parent{
public Child Foo(){
return new Child();
}
}
class Child : Parent{}
I've heard that referring to a derived type from a base type is always bad and signs of bad design. Can someone tell me why this is bad or even if it is bad?
© Stack Overflow or respective owner