Here is some code explanation:
abstract class parent
{
protected void longFunction()
{
//........
}
protected void longLongLongFunction()
{
//........
}
protected abstract void changeMe();
}
class child : parent
{
protected override void changeMe()
{
longFunction();
}
}
In my particular case it is more comfortable for me to declare all possible methods inside the abstract parent class, and then the children pick-up/call only the methods that they need. So if a child calls only one method of 5 declared in the parent class, will the produced object contain the code of the 4 never called functions? If I declare the methods externally, I would have to pass down to them lot of parameters and it is much briefly to have the methods that way because they can directly use the "protected" fields of the parent class. So in the code above, will longLongLongFunction be included at compilation time in the created instance of child class, making that way the final program unnecessarily large?
I think this question is not duplicate of this question because some children will call the methods that are unused by others. So at some moment those methods will be called, and needed, but not by all children. Let's say only 5 of 10 children will call the second method. Will all 10 instances of the children include that method just because it is declared in the parent?