The appeal is from a judgment on the pleadings. A court of record has inherent power to render judgment on the pleadings where *633tbe facts shown and admitted by the pleadings entitle a party to such-judgment. 49 C.J., Pleading, section 944.
A motion for judgment on the pleadings is in the nature of a general demurrer. Pridgen v. Pridgen, 190 N.C. 102, 129 S.E. 419. Its function is to raise this issue of law: Whether the matters set up in the pleading of an opposing party are sufficient in law to constitute a cause of action or a defense. Adams v. Cleve, 218 N.C. 302, 10 S.E. 2d 911.
When a party moves for judgment on the pleadings, he admits these-two things for the purpose of his motion, namely: (1) The truth of all well-pleaded facts in the pleading of his adversary; and (2) the untruth of his own allegations in so far as they are controverted by the pleading-of his adversary. Oldham v. Ross, 214 N.C. 696, 200 S.E. 393; Churchwell v. Trust Co., 181 N.C. 21, 105 S.E. 889; Alston v. Hill, 165 N.C. 255, 81 S.E. 291; Helms v. Holton, 152 N.C. 587, 67 S.E. 1061.
For this reason, a motion for judgment on the pleadings constitutes, an appropriate remedy where the pleading of the opposite party is so. fatally deficient in substance as to present no material issue of fact. Dunn v. Tew, 219 N.C. 286, 13 S.E. 2d 536; Penny v. Ludwick, 152 N.C. 375, 67 S.E. 919. A plaintiff is entitled to judgment on the pleadings where the answer admits every material averment in the complaint and fails to set up any defense or new matter sufficient in law to defeat his claim; and a defendant is entitled to judgment on the pleadings where the complaint fails to state a good cause of action in favor of the plaintiff and against the defendant. Smith v. Smith, 225 N.C. 189, 34 S.E. 2d 148, 160 A.L.R. 460; Mitchell v. Strickland, 207 N.C. 141, 176 S.E. 468.
The first issue of law raised by the plaintiff’s motion for judgment on. the pleadings is whether the admitted acts of the defendants constitute a violation of the zoning ordinance of the City of Ealeigh.
Although the zoning ordinance of 9 November, 1944, professed to-repeal the zoning ordinance of 20 April, 1923, it simultaneously reenacted in substantially the same terms the provisions of the old ordinance requiring building permits and certificates of occupancy, prescribing permitted uses of property in residence districts, and prohibiting the-establishment or maintenance of businesses in residence districts. This being true, these provisions have been in force at all times since their original enactment on 20 April, 1923; for it is well settled “that where-a statute is repealed and all, or some, of its provisions are at the same-time re-enacted, the re-enactment is considered a reaffirmance of the old law, and a neutralization of the repeal, so that the provisions of the repealed act which are thus re-enacted continue in force without interruption, and all rights and liabilities thereunder are preserved and may be enforced.” 50 Am. Jur., Statutes, section 555; Brown v. Brown, 213 N.C. 347, 196 S.E. 333.
*634Tbe answer admits tbat tbe premises at 2512 Everett Avenue bave been located in a residence district of tbe City of Raleigb since 1923; tbat tbe defendants bave been conducting a commercial business upon sucb premises since 1938; and tbat tbe building inspector of tbe City of Raleigb bas never issued a certificate of occupancy authorizing tbe defendants to use sucb premises for any purpose. Hence, tbe pleading of tbe defendants makes it plain tbat they are now, and ever since 1938 bave been, engaged in a twofold violation of tbe zoning ordinance of tbe City of Raleigb.
Sections 10, 26, and 28 of tbe ordinance of 9 November, 1944, bave no application to tbis litigation. As tbe defendants bave been acting in contravention of tbe zoning regulations at all times since 1938, it cannot be said tbat tbey are simply continuing a use of tbe premises wbicb was legal at tbe effective date of tbe new ordinance or at any other time. Tbe building permits authorized tbe feme defendant to erect tbe building at 2512 Everett Avenue for a “designated or intended use,” to wit, a residence. Tbe plaintiff does not prosecute tbis action against tbe defendants to “repeal, abrogate, annul, or in any way impair or interfere with” sucb building permits, or to “require any change in tbe plans, construction, (or) designated or intended use” of tbe building erected under them.
Tbe second issue raised by tbe plaintiff’s motion for judgment on tbe pleadings is whether tbe City of Raleigb is estopped to enforce its zoning ordinance against tbe defendants by tbe fact tbat its officials bave encouraged or permitted them to violate it for at least ten years.
Tbe motion admits tbe truth of tbe factual averments in tbe answer. In consequence, it must be taken for granted tbat tbe feme defendant bought tbe land at 2512 Everett Avenue and erected a residence on it upon an understanding tbat tbe officials of tbe City of Raleigb would permit tbe premises to be used for business purposes in violation of tbe zoning ordinance putting sucb premises in a residence district; tbat at all times between tbe year 1938 and 4 August, 1948, tbe officials of tbe City of Raleigb knowingly encouraged or permitted tbe defendants to devote tbe premises in question to business purposes in violation of tbe zoning ordinance restricting them to residential uses; and tbat tbe defendants made substantial outlays of money in their business and upon their property in reliance upon their belief tbat tbe officials of tbe City of Raleigb would permit them to continue tbe use of the premises at 2512 Everett Avenue for commercial purposes in violation of tbe zoning ordinance.
Even so, tbe second issue of law raised by tbe plaintiff’s motion must be resolved against tbe defendants.
Tbe zoning ordinance was adopted by tbe City of Raleigb, a municipal corporation, under statutes originally embodied in Chapters 169 and 246 *635of the Public-Local Laws of the Extra Session of 1921 and Chapter 250' of the Public Laws of 1923.
“A municipal corporation is dual in character and exercises two classes: of powers — governmental and proprietary. It has a twofold existence — ■ one as a governmental agency, the other as a private corporation. Any activity of the municipality which is discretionary, political, legislative or public in nature and performed for the public good in behalf of the State, rather than for itself, comes within the class of governmental functions . . . While acting in behalf of the State in promoting or protecting the health, safety, security, or general welfare of its citizens, it is an agency of the sovereign.” Green v. Kitchin, 229 N.C. 450, 50 S.E. 2d 545; Millar v. Wilson, 222 N.C. 340, 23 S.E. 2d 42.
In enacting and enforcing zoning regulations, a municipality acts as a governmental agency and exercises the police power of the State. Kinney v. Sutton, 230 N.C. 404, 53 S.E. 2d 306; Elizabeth City v. Aydlett, 201 N.C. 602, 161 S.E. 78; S. v. Roberson, 198 N.C. 70, 150 S.E. 674. The police power is that inherent and plenary power in the State which enables it to govern, and to prohibit things hurtful to the health, morals,, safety, and welfare of society. Drysdale v. Prudden, 195 N.C. 722, 143 S.E. 530; Skinner v. Thomas, 171 N.C. 98, 87 S.E. 976. L.R.A. 1916E, 338. In the very nature of things, the police power of the State cannot be bartered away by contract, or lost by any other mode.
This being true, a municipality cannot be estopped to enforce a zoning-ordinance against a violator by the conduct of its officials in encouraging- or permitting such violator to violate such ordinance in times past. Leigh v. Wichita, 148 Kan. 607, 83 P. 2d 644, 119 A.L.R. 1503, and cases noted in the ensuing annotation. See these North Carolina decisions: Jenkins v. Henderson, 214 N.C. 244, 199 S.E. 37; S. v. Finch, 177 N.C. 599, 99 S.E. 409; Bank v. Commissioners, 119 N.C. 214, 25 S.E. 966, 34 L.R.A. 487; S. v. Beavers, 86 N.C. 588; Wallace v. Maxwell, 32 N.C. 110, 51 Am. Dec. 380; Candler v. Lunsford, 20 N.C. 542.
Undoubtedly this conclusion entails much hardship to the defendants. Nevertheless, the law must be so written; for a contrary decision would require an acceptance of the paradoxical proposition that a citizen can acquire immunity to the law of his country by habitually violating such law with the consent of unfaithful public officials charged with the duty of enforcing it.
The pertinent statute expressly provides that an injunction may be secured by a municipality to prevent a violation of a zoning ordinance. G-.S. 160-179.
For the reasons given, the judgment is
Affirmed.