I started my first code in solidity . when i was implemented getter and setter i have face some error .
The Following code,
pragma solidity ^0.5.0;
contract MyFirstContract{
string private name;
uint private age;
function setName(string newName) public{
name=newName;
}
function getName()public view returns(string){
return name;
}
function setAge(uint newAge) public{
age=newAge;
}
function getAge()public view returns(uint){
return age;
}
}
Error 1:
browser/MyFirstContract.sol:7:22: TypeError: Data location must be "memory" for parameter in function, but none was given.
function setName(string newName) public{
^------------^
Error 2:
browser/MyFirstContract.sol:10:43: TypeError: Data location must be "memory" for return parameter in function, but none was given.
function getName()public view returns(string){
^----^