delivered the opinion of the court.
The plaintiff elected to stand upon his complaint after a general demurrer thereto had been sustained. Judgment for the defendants was entered, and this appeal is the result
The material allegations of the complaint, píeaded as one Cause of action, may be epitomized as follows: That the plaintiff is the father of Emma Nixon, who was run over and killed by one of defendants’ trains on December 5, 1912; that at and for some years prior to that time the defendant company was engaged in operating a railway through Bear Creek, an unincorporated village in Carbon county; that it was the duty of said company to maintain on both sides of its track a good and legal fence and to keep at its crossings cattle-guards over which cattle and other domestic animals could not pass, but in this duty it wholly and negligently failed; that at the time of the accident Emma Nixon-was eight years old and resided about one and one-half miles west of Bear Creek, south of the company’s track; that she, together with a great number of other children residing in the same neighborhood, attended school at Bear Creek, north of the track; that because of defendants’ failure to maintain a good and legal fence it became and was the custom of such children to walk upon said track, particularly between 3 and 5 P. M. of each day, except Saturdays and Sundays, and said track, for many years prior to the date of the accident, had been used as a common highway for pedestrians en route to and from Bear Creek, all of which was well known to the company; that it was also a common custom for such children, when returning from school by way of said track, to attempt to ride upon the rear end of the trains traveling thereon, especially if such trains were moving slowly, and this the defendants well knew; that at the time of the accident one of the company’s trains was moving slowly between Bear Creek and the residence of Emma Nixon, *100which train consisted of nine cars, two of which cars were placed in an unusual position, to-wit, behind the caboose; that said train, so made up and so moving, was attractive to children and was dangerous; that defendants should have known these facts, and should have known that such children would attempt to ride said train, and should, in the exercise of ordinary care, have placed some person upon the rear thereof, to prevent such children riding thereon; that defendants failed to do that, or to do anything in that behalf; that Emma Nixon, and other children, entered said track at a point where it was the duty of defendants to have kept a fence, and, being upon said track to the knowledge of defendants, was attracted by the train so made up and slowly moving, and was thereby impliedly invited to ride the rear thereof, and attempted to do so, being too young to appreciate the danger; that her death was the result of that attempt.
The question presented is whether a cause of action is stated in the foregoing facts, bearing in mind that the complaint stands confronted only by a general demurrer, and that the duty of this court is to search it from end to end and determine whether its sufficiency can be reasonably asserted upon any theory. The appellant insists that a cause of action is stated under (1) the statutory duty imposed upon railway companies to fence, and (2) under the common-law duties arising upon implied invitation.
1. The application to this case of the statutory duty imposed upon railway companies to fence is erroneously assumed in [1] con-sequence of the decision of this court and some authorities cited in Conway v. Monidah Trust, 47 Mont. 269, 132 Pac. 26. A moderately discriminative reading of that case should have satisfied counsel that it not only does not sustain his view, but makes directly against it. We there dealt with a statutory provision the manifest purpose of which was to impose an absolute duty for the protection of persons, for the benefit, not of a class, but of the entire public considered as a composite of individuals; we took pains to distinguish those statutes which impose a duty for the benefit of the public considered as a com*101posite of individuals, from those statutes which impose a duty for the benefit of a particular class, and we held that in the one case a right of action may arise in favor of any person especially injured by a failure in such duty, while in the other a right of action could accrue only to a person of the contemplated class. The fencing statute invoked as a basis of liability in this case, is as follows: “Railroad corporations must make, and maintain a good and legal fence on both sides of their track and property, and maintain, at all crossings, cattle-guards over which cattle or other domestic animals cannot pass. In case they do not make and maintain such fence and guards, if their engines and cars shall kill or maim any cattle or other domestic animals upon their line of road, they must pay to the owner of such cattle or other domestic animals, in all eases, a fair market price for the same, unless it occurred through the neglect or fault of the owner of the animal so killed or maimed. Provided, that nothing herein shall be construed so as to prevent any person, or persons, from recovering damages from any railroad corporation for its negligent killing or injury to any cattle, or other domestic animals, at spurs, sidings, Y’s, crossings and turntables.” (Sec. 4308, Rev. Codes.) This language, as well as the history of the section, demonstrates that its enactment was for the particular benefit of a particular class. In every ease where liability exists because of failure to perform a specific duty, there is involved the proposition that no liability exists when such duty has been performed; but the notion that the legislature intended compliance with this statute to absolve from liability for injuries to children is beyond the pale of discussion.
2. The argument upon implied invitation is, like the complaint, of rather mixed complexion. At one time the invitation is implied from custom, at another from attraction under the so-called “turntable doctrine,” and often it is directed to the presence of the child near the track, instead of to her attempt to board the train. The extent to which the turntable doctrine has been accepted in this state, and how it may be invoked, are disclosed in Driscoll v. Clark, 32 Mont. 172, 80 Pac. 1, 373, and *102in Gates v. Northern Pacific Ry. Co., 37 Mont. 103, 94 Pac. 751. The effect of these cases is to hold that, while an invitation may be implied from the maintenance, by the owner, of dangerous machinery upon his premises, which is so especially and unusually alluring to children of tender years that they are attracted thereby to the knowledge of the owner, he may nevertheless conduct his business on his own premises with such machinery, operated in such manner as may be necessary and convenient to make his business successful; and, if it does not appear but that the machinery or the use thereof was proper, necessary and convenient, and that it was especially and unusually attractive to children, and that its unusual attractiveness to children was known, or should have been known, to the owner, no cause of action under the turntable doctrine is stated. As elucidating some of the circumstances to which this doctrine cannot be applied, we incorporated in the Driscoll Case certain expressions of the supreme court of Texas in San Antonio etc. Ry. Co. v. Morgan, 92 Tex. 98, 46 S. W. 28, including the following: “It has been contended broadly that when an owner places * * * anything upon his property which is attractive to others and one is thereby induced to go thereon, the invitation may be inferred as a fact by the court or jury. Now, since it is manifest that to some classes of persons, such as infants, the things ordinarily in existence and use throughout the country, such as rivers, creeks, ponds, wagons, axes, plows, woodpiles, haystacks, etc., are both attractive and dangerous, it is clear that the adoption of such a broad contention would be contrary to reason, lead to vexatious and oppressive litigation, and impose upon the owners such a burden of vigilance and care as to materially impair the value of property and seriously cripple the business interests of the country. Therefore it has been generally held that the invitation cannot be inferred in such cases. ”
Analyzing the complaint, we observe that the attraction was a train, the only unusual feature of which was that two cars [2] were behind the caboose. It is alleged that defendants knew, or ought to have known, that the children including *103Emma Nixon, would be attracted by tbe train; but it is not alleged that this train, or trains, so made up, were any more attractive than other trains. The mere fact that trains, as such, are attractive does not suffice; for they are familiar objects and, whether moving rapidly or slowly, they are necessary instru-mentalities through which a railroad must conduct its business. So, too, the placing of cars behind the caboose may have been quite reasonable and proper. In any event, there is no intimation in the complaint that from previous practice, or otherwise, the company or its agents knew, or should have known, that a train so made up was especially alluring to children. No reason is suggested why this should be so, and the other allegations strongly indicate that such was not the fact. In no jurisdiction, so far as we are informed, in which the turntable doctrine is accepted, has it been applied to moving trains. (Underwood v. Western etc. R. R. Co., 105 Ga. 48, 31 S. E. 123; Wilson v. Atchison etc. Ry. Co., 66 Kan. 183, 71 Pac. 282; Catlett v. St. Louis etc. Ry. Co., 57 Ark. 461, 38 Am. St. Rep. 254, 21 S. W. 1062.) The complaint cannot be sustained upon this theory.
It is not necessary to canvass the averments touching the im-[3] plied invitation to Emma Nixon and her companions to be upon or near the track at the time and place of the accident. Suffice it to say that they were there, and the complaint contains enough to charge that they were there by invitation to use the track as a highway, implied, not from want of a fence, but from custom. It was therefore the duty of the company to expect their presence and to operate the dangerous instrumentalities of its business accordingly. This, however, is not important, because Emma Nixon was not killed while she was on the track using it as a highway; she was killed in consequence of her attempt to board a moving train. Her presence near the track was, of course, necessary to an attempt to board a train, but a license to use the track as a highway does not carry with it an invitation to use the track for other purposes, or to board the company’s trains, or to use any of its other property.
Assuming, but not deciding, that an invitation to children to [4] board its moving trains can be implied from toleration by the company of previous attempts so to do, we may, by piecing *104an averment here with an averment- there, say that such an invitation is sufficiently alleged. To make it available to the plaintiff, however, we should be obliged to ignore the plain meaning of paragraphs 13 and 15. In these paragraphs we are expressly told that the invitation upon which the fatal attempt was made was the invitation implied from the attractive character of the" train, and we are inferentially informed that the attempt was not made upon any other invitation.
The ruling complained of was correct, and the judgment appealed from is affirmed.
Affirmed.
MR. Chief Justice Brantly concurs. Mr. Justice Holloway, being absent, did not hear the argument, and takes no part in the foregoing decision.