pragma solidity ^0.5.0;

contract Accessor {
    
    uint private personCount = 0;
    
    struct  Person  {
        uint id;
        string firstName;
        string lastName;
    }
    
    mapping(uint => Person) private persons;
    
    function incrementCount() private {
        personCount += 1;
    }
    
    function addPerson(string memory firstName, string memory lastName ) public {
        incrementCount();
        Person memory p = Person(personCount,firstName,lastName);
        persons[personCount] = p;
    }
    
    
    // Gets the error of DataLocation must be memory for the return parameter in function.
    function getPerson(uint _id) public view returns(Person) {
        return persons[_id];
    }

}