All Questions
1 question
32votes
10answers
8kviews
Is "Parent x=new Child();" instead of "Child x=new Child();" a bad practice if we can use the latter one?
For example,I had seen some codes that create a fragment like this: Fragment myFragment=new MyFragment(); which declares a variable as Fragment instead of MyFragment , which MyFragment is a child ...