Aside from the practical fact that method 2 will cost more gas than method 1 because method 1 encapsulates the function call to remain internal, I would suggest that your decision should be made from the engineering perspective–logic, readability, and simplicity.
In method 1, you have established a parent contract A
and created a child B
. B
will inherit everything from its parent A
, including all of its other functions and properties, not just this one. If this makes sense in this use case, if A
should be the base contract that B
inherits from, then method 1 is what I would suggest.
In method 2, you have not established any parent-child relationship between A
and B
. Contract A
is merely there and so is B
; they are independent objects. But B
wishes to access a function in A
and so it does. If this relationship between the two contracts makes sense in this use case then method 2 is what I would suggest.
The above is the logical evaluation. Now suppose method 2 makes the most logical sense–the two contracts should not be related as parent and child–but you want to save on gas so you opt for method 1 anyway. This code implementation would not read well at all. It would be deliberately confusing and unnecessarily complex and would violate the basic tenets of OOP. But if you really are on a shoestring budget then engineering will always take a backseat to business, unfortunately.