Let's suppose I have a simple smart contract defining a person with a couple of attributes (for instance Name and Age) and in another smart contract I have a population (with an array of people). I could have a function to return one person like:
function getPerson(uint _index) view returns(Person){
return population[_index];
}
And I'll get something like: 0x9e0BC6DB02E5aF99b8868f0b732eb45c956B92dD (what is a Person' object). But, I'd like to see the attributes of that person. How can I do that? I could make a function like this one (I guess):
function getPersonName(uint _index) view returns(string){
return population[_index].getName();
}
But I don't like this solution. I mean, is there any chance to see the attributes of my Person object having this address 0x9e0BC6DB02E5aF99b8868f0b732eb45c956B92dD?