Im trying to create a StandardMidiFile Object,
It will contain a HeaderChunk Object
and a TrackChunk object.
The TrackChunk Object will contain MidiEvent objects.
So when I create this StandardMidiFile Object,
I want it’s constructor to construct & contain the other objects.
But, when the TrackChunk Object is created it first needs to call a getter method in a GUI-UserControl Class that will determine the total Length of the all MidiEvents in bytes.
And that value will then be used in constructing the TrackChunk.
Is it good OOP practice to call a method inside a constructor?
What I would do is pass in the track length as a constructor parameter.
Of course, it really depends on the rest of your design. If TrackChunk is intended to be only an object used in StandardMidiFile, then this makes more sense to me. Either way is “correct”, I believe.