Hello,
I wrote very basic Concatenation and StringUtil contracts. I tried to apply composition approach with using Concatenation contract with creating an instance inside of StringUtil. However, Solidity compiler warned me to add payable keyword to concatenate function in order to consume it from StringUtil contract. I thought that concatenate had not be a payable operation. Is there a way to use that function without consuming gas? Some ideas that i write below come on my mind but they are not good.
-
Copying whole Concatenation contract code into StringUtil and directly use in it. However, it is not a good approach.
-
Extending StringUtil from Concatenation(contract StringUtil is Concatenation). However, i need to write more functionalities inside of newly created contract lets say Comparer and use it as same approach. This is also not good. Because, StringUtil is aldready extended from Concatenation.
What are your thoughts? Do you know best practices on this subject?
Thank you.