Opinion op the court by
JUDGE HOBSONRevebsing.
Appellant filed this suit to require appellee, under the-statute, to fenee its right of way -through his farm. He-*216alleged in his petition that he had given the right of way for the railroad, and hadJ in writing requested appellee to construct and maintain a lawful fence on both sides of its right of way through his lands, and that this it had refused to do. The court below sustained a demurrer to his petition. The propriety of this ruling depends entirely on the validity and proper construction of the statute on which the action was based. The original act was approved May 17, 1886 (Gen. St. p. 759), and was re-enacted, with certain modifications, February 25, 1893, constituting sections 1789-1799, Kentucky Statutes. Its provisions, so far as material to this case, are as follows:' .
“Section 1789. That when any corporation or person owning or controlling a railroad in this Commonwealth, owns right of way, and its railroad shall have been constructed and in operation for the period of five years, the same is hereby put on equal terms and -obligations with other landowners owning adjoining- lands in this Commonwealth.
“Section 1790. That every such corporation or person •owning or controlling and operating a railroad in this Commonwealth, and owning right of way, shall construct and maintain a good and lawful fence on one-half of the distance of the division line between such rights of way and the adjoining lands, except as is hereinafter provided; and that every owner of land or lands adjoining any rights of way of such corporation or person as aforesaid shall construct and maintain a good and lawful fence on -one-half of the distance of the division line between such land or lands and such rights -of way, except as is hereinafter provided.
“Section 1791. That when either party, either the corporation or person owning or controlling and operating such *217railroad, or the owner of lands adjoining the right of way thereof, has constructed or. does construct a good and lawful fence on the division line between such right of way and the lands adjoining the same for one-half the distance of said line, and the other party has not constructed such feqce on said line for half the distance thereof, nor has paid a sum sufficient to construct such fence or any sum by agreement in lieu thereof, the party who has constructed such fence, as herein provided, shall, in writing, notify the party in default of the length of the division line between them and that he (the party serving such notice) has constructed a good and lawful fence on said division line for one-lialf the distance thereof; and it shall be the duty of the party on whom such notice iis served, and he is hereby required, to construct a good and lawful fence on the other half of the distance of said division line, within four months after the date of receiving said notice. Where the corporation, or person, owning or controlling and operating the railroad, is in default, such notice may be served on the nearest station agent thereof. If the party on whom such notice is served fail to construct such fence as is herein provided, and within the time prescribed, such party so in default shall be fined one dollar for each and every day after the expiration of the said period of four months during which such fence shall not have been constructed. Said fines may be recovered by warrant in the name of the Commonwealth of Kentucky before any court of competent jurisdiction.
“Section 1792. That the provisions of this act shall not apply in any case wherein any corporation or person owning or controlling and operating such railroad has furnished the material to construct a fence, or condemned its right of way, and paid the owner of his vendor damages, *218in' tbe estimation oí Which the cost of fencing was taken into consideration, nor be so construed as to require such corporation or person as aforesaid to build any fence along the line through any town or city, or across any public or private passway; nor shall such corporation or person be required to construct such fence as hereinbefore provided through unimproved and uncultivated lands until the owner of such lands shall have previously inclosed such lands on three sides with sufficient fences, or unless such land be so inclosed with fences and a river, creek, bluff, or such other natural barrier as will prevent the egress of stock.”
“Section 1794. That any landowner, who has already built a lawful fence along the whole distance of the division line between his land and the right of way of any railroad, shall have the right (in the absence of any agreement to the contrary), after giving three months’ notice to the corporation or person operating said railroad (to be served on the nearest station agent) of such intention, to move one-half of said fence: provided, however, he shall not, in removing such part of his fence, cause such corporation or person aforesaid to erect watergaps, and to fence at points where the grade of the roadbed is of such character as may render fencing unnecessary
“Section 1,796. That this act shall not apply to any land where the owner or his vendor has received compensation for fencing the same.
“Section 1797. That when the owner of any land or lands or any immediate or remote grantor or vendor of such owner, has given to the corporation or person owning or controlling and operating any railroad a right of way through such land or lands free of charge, then the entire fencing on the division lines between such lands and the *219right of way of such railroad shall be done by and at the cost of the corporation or person owning or controlling and operating such railroad, said, fencing to be done as required by this act.”
It is insisted for appellee that the statute is unconstitutional, and we are referred to the case of Railroad Co. v. Todd, 91 Ky., 175, (15 S. W., 56), as conclusively settling this question. But there are two important particulars in which this case differs from that. The original act, which was there held unconstitutional, exempted the owner of the adjoining lands from any part of the burden, and placed all of it on the company. Under that act, while the adjoining proprietor could, by notice, require the railroad company to build half of the fence, there was no such reciprocal right on the part of the railroad company against him in case it desired a fence built. In that case, also, the deed to the railroad company had been made about ten years before the act wa-s passed, and when the deed was made and accepted there was no law in existence making it obligatory on the railroad company to build any part of the fence between its right of way and the land of adjoining owners on notice from them. The rights of the parties, having vested Tinder their contract, could not be disturbed by the Legislature by a subsequent act, so' as to put all the burden of the fence on one of them, at the option of the other, without any corresponding burden on him.
In this case the grant of the right of way was made after the 'Statute was passed, and persons who contract after a statute has taken effect must be presumed to' contract with reference to it. Undoubtedly the Legislature might, as to future contracts, make it the law that the railroad company accepting a gift of the right of way should do the entire fencing on the division' lines between it and the *220adjoining lands. Thus, statutes creating 1-iens in favor of mechanics and others are universally sustained as to transaction's had after they take effect. So, for many years we have had statutes declaring the effect of the words, “with general warranty,” in a deed, or the absence of words of inheritance, and regulating Mens for purchase money. The ‘present statute is different from the act -so forcibly condemned in the case referred to. By section 1791, above quoted, either the owner of the railroad or the owner ol the adjoining land may give the notice, and require the other to build half of the fence. The burden is no longer one-sided, but mutual, and each party has the same right where the right of way has not been donated. The right of .way in this case having been granted after the act took effect, we are of opinion that the statute, so far as appellant is concerned, at least, is not liable to- the constitutional objections sustained to the former act.
Tt remains to construe the statute, and determine the rights of the parties under it. It will be seen, from the sections abo-ve quoted, that section 1789 places the owners of railroads that have been constructed and in operation for the period of five years on equal terms and obligations with other owners of adjoining land, and that by section 1790 the owner of such railroad and the owner of the adjoining land are each required to construct and maintain a fence on -one-half the distance of the division line between them. Section 1791 provides how these provisions may be enforced. At the time the act was passed,- in many places the' railroads had by contract imposed up'on the landowners the burden of the fencing along the right of way. Section 1792 exempts from the operation - of the act cases of this character -and some others not deemed proper to be included. Section 1794 relates to a converse *221state of case, where the landowner had built the fence altogether, and was intended to give him a remedy, unless, as 'Set out in section 1796, he or his vendor had received compensation for fencing the land. Section 1796 appears to be a limitation on .section 1794, just as 1792 is a limitation on 1791. Section 1797 is, however, an independent provision. In the original act it begins with the word '‘provided.” The Change of phraseology in the present statute is so slight that it could not have been intended to change the sense. The necessary meaning of the section is that, where the right of way has been donated, a different rule shall apply from that prescribed by the preceding sections, and that in this state of case the entire fencing of the division line between the adjoining lands shall be done by the railroad company and at its cost. That this rule can not be applied to grants made before the act was passed was determined in the Todd Case supra; but, appellant’s grant having been made after the statute was enacted, he is entitled to the benefit of its provisions. It follows that the court below erred in sustaining the. demurrer to the petition. The judgment is therefore reversed, and cause remanded for further proceedings not inconsistent with this opinion. It was not necessary for the plaintiff to negative in the petition the exceptions contained in section 1792. These are matters of defense, to be pleaded by appellee.