A city or town is a body politic and corporate with the general powers of a corporation and the powers specified or necessarily implied in this title or in special laws heretofore enacted.