The question is not so much about visibility but accessibility. Contracts on the blockchain are viewable by everyone in bytecode (not in Solidity however).
In terms of accessibility- who has permission to make calls to your function, you can use modifiers. In this case you would define an onlyOwner modifier earlier in the contract like so:
modifier onlyOwner {
if(msg.sender != owner) throw;
_
}
When creating the contract, you can define the owner as a state variable and assign it in the constructor of the contract (the function which is implemented when the contract is created).
To restrict access to myFunction you would add the onlyOwner modifier after the input parameters, so that if anyone calls the myFunction contract without calling from the address defined in owner address variable, it will fail.
function myFunction(string name) onlyOwner private returns(bool) {
return true;
}
You can also have modifiers to restrict access to other trusted addresses in your contract.
public, does this means other contracts have full access to the variable, i.e. can other contracts access the variable and even change it's value? – Prashant Prabhakar Singh Aug 08 '16 at 08:32