I have 2 contracts, Parents
and Child
which has a public string variable - name
.
contract Child {
string public name;
function child (string _name){
name = _name;
}
}
Parents
needs to get that name:
contract Parents {
string public childName;
Child child;
function Parents(address _childAddress){
child = Child(_childAddress);
childName = child.name(); // I also tried child.name
}
}
But I'm getting the following error:
Error: Type tuple() is not implicitly convertible to expected type string storage ref.
childName = child.name();
So I've tried to create another function in Child
that will return a string:
function getName() returns (string name) {
return name;
}
And in Parents
I've changed
childName = child.name(); into---> childName = child.getName();
But I keep getting the same error. Any ideas? As always, your help is appreciated.