It is not possible to change the visibility of a contract function. Visibility on the function actually affects whether the function will appear in the contract ABI and stuff, so definitely not right to go down this path anyway.

Based on your comments, it looks like you are trying to make a function only work for a certain amount of time. I believe is is best accomplished using a require statement which checks the time or blocks of the function call compared to contract creation, or some other fixed time.

Something like this:

pragma solidity ^0.4.24; contract Test { address[] public signups; uint createTime; constructor() public { createTime = now; } function signupsStopAfter10Min() public { require(now < createTime + 10 minutes); signups.push(msg.sender); } }

You could of course make this require statement it's own modifier if you think this will apply to multiple functions.