Cobb, J.
The official report states the facts.
1. In order for a mechanic or materialman to obtain a lien upon real estate, under the provisions of section 1979 of the Code of 1882, as it stood prior to the passage of the acts of 1893 and 1895 amending the same (Acts 1893, p. 34; Acts 1895, p. 27), it was necessary that the mechanic or materialman should either have a contract for the work done or material *136furnished with the owner of the property, or a contract for such work and material with a contractor who had a contract with the owner. In the first instance, that is where the me: chanic or materialman dealt directly with the owner, the lien attaches to the property improved,, to the extent of the amount contracted to be paid. In the latter case, no lien attaches to the property until written notice stating the amount claimed has been served upon the true owner before he settles with such contractor, and then only to an amount not exceeding the sum which would then be due by the owner to the contractor. Therefore, where it appeared that a mechanic did work and a materialman furnished' materials in building section-houses for a railroad company, and the contracts for such work and material were not’ made with that company, but were made with another corporation—a construction company, which had contracted with the railroad company to do such work and furnish such materials, and there was no attempt to comply with the provisions of the statute which required in such cases notice to the railroad company as the true owner óf the property, no lien would arise in favor of either the mechanic or the materialman as against the property of the railroad company. In such case they would fail to obtain a lien under the first provision of the section alluded to, because they sustained no contractual relation to the railroad company, and a failure to give the notice required would prevent the lien provided in the latter part of the section from arising in their favor.
2. A “contractor to build railroads” is entitled to alien upon the railroad built, under the same circumstances that a mechanic and materialman would be allowed such lien. Therefore, where it appeared that such contractor neither had a contract with the railroad company, nor had served any notice upon it as the true owner of the property, such contractor was not entitled to enforce a lien against the property of the company.
3. That it appeared that the true owner of the property was a corporation, and that the construction company which had the contract to build the railroad and section-houses was another corporation which owned all the stock of the railroad *137company, did not malee the two corporations identical, and give to the mechanic, materialman, or contractor, as the case may be, the right to treat the property of the railroad company as the property of the construction company. The two corporations were distinct persons in law, and the contractual relation with one would not be sufficient as a foundation for asserting a lien, under the provisions of the'section above mentioned, against the property of the other. Exchange Bank v. Macon Construction Company, 97 Ga. 1.
Judgment on main bill of exceptions reversed; on cross-bill, affirmed.
All the Justices concurring.