1. The iron of the Boston and Lowell Railroad being at the outset in worse relative condition than that of the Nashua and Lowell Railroad and branches, it was agreed that in *223the final settlement of the contract the iron of the Boston and Lowell road should be left in the same relative worse condition, or otherwise its improved relative condition should be paid for by the Boston and Lowell Railroad Corporation on its separate account. The existing difference at the outset was appraised as equivalent to the cost of replacing three hundred tons of old rails with new. The report finds that, at the termination of the contract, the rails of the Boston and Lowell road were not in a relatively worse condition than those of the Nashua and Lowell road, and that the cost of replacing three hundred tons of old rails with new was agreed by the parties to be $9,711.88. The report further finds, that whatever was expended upon the roadbed of the Boston and Lowell road during the existence of the contract was from the joint fund. It thus appears that, instead of the. Boston and Lowell Railroad Company’s paying for the improvement on its separate account, the improvement was paid for out of the joint fund, in which the plaintiff was interested to the extent of thirty-one per cent. The amount, therefore, which the plaintiff could recover for this item is thirty-one per cent of $9,711.88, or $3,010.68. Nashua Lowell Railroad v. Boston & Lowell Railroad, 157 Mass. 268.
2. The defendant, however, contends that the traffic contract was ultra vires, and that neither corporation had power under its charter to agree with the other to operate their railroads as one road. No authority has been cited in favor of this view, but it would seem to be supported by decisions in New Hampshire, Burke v. Concord Railroad, 61 N. H. 160. See also Boston, Concord, & Montreal Railroad v. Boston & Lowell Railroad, 65 N. H. 393.
We do not, however, need to enter upon this question, because the plaintiff’s suit, to the extent above mentioned, may be maintained on an independent ground. The joint manager, without authority either under the contract or otherwise, used the joint fund belonging to the two railroad companies for the improvement of the relative condition of the defendant’s road. In this way the defendant has, without right, received the benefit of funds belonging to the plaintiff, and an action may be maintained to recover for the same, even though the traffic contract was ultra vires. Slater Woollen Co. v. Lamb, 143 Mass. 420. Nims v. Mount Hermon Boys’ School, 160 Mass. 177. L’Her*224bette v. Pittsfield National Bank, 162 Mass. 137. Central Transportation Co. v. Pullman's Palace Car Co. 139 U. S. 24, 60. Logan County National Bank v. Townsend, 139 U. S. 67, 74-76. Manchester & Lawrence Railroad v. Concord Railroad, 20 Atl. Rep. 383. Central Trust Co. v. Ohio Central Railroad, 23 Fed. Rep. 306.
3. The defendant further contends that the plaintiff is estopped to maintain this suit by the judgment or decree entered in favor of the plaintiff against the defendant in the Circuit Court of the United States. No authority is cited in support of this view. It appears that the plaintiff brought a bill in equity in that court against the defendant upon the claim now in suit here, and upon other distinct claims; that, after issue was joined therein, the plaintiff moved for leave to amend its bill by striking out the present claim; that after a hearing this motion was denied by the court; that thereupon the plaintiff filed in the Circuit Court a paper disclaiming and discontinuing its bill as to said claim; that this paper was filed without leave of court, and there was never any order of court upon it; that after various intermediate proceedings a final decree was entered in the Circuit Court for the plaintiff for one of the claims set forth in its bill, no mention being made therein of the claim now in suit; and that afterwards said decree was performed, and satisfied of record.
The defendant has not in its answer averred, nor by its evidence proved, that the present claim was in fact argued, considered, or determined in the Circuit Court. The report is silent upon this point. If this had been done in point of fact, of course the present suit could not be maintained. What we have to consider is, whether, upon the case as it is presented to us, we should assume that it was so determined, and whether, looking merely at the record, the legal effect of the former decree is to estop the plaintiff now.
In the first place, it is clear that the plaintiff’s attempt to withdraw the present claim from that suit, in spite of the refusal of the court to permit such withdrawal, was nugatory. The case stood thereafter just as if no such attempt had been made. No doubt, as a general, though not universal proposition, at any time before a hearing the court on application made will allow a plaintiff in equity to dismiss his whole bill as of course, upon payment of costs. Kempton v. Burgess, 136 Mass. 192. Such *225dismissal, however, is not made without an order of court; and there may be facts which would lead the court to refuse to allow it. Chicago & Alton Railroad v. Union Rolling Mill, 109 U. S. 702, 713. Electrical Accumulator Co. v. Brush Electric Co. 44 Fed. Rep. 602. Hat-Sweat Manuf. Co. v. Waring, 46 Fed. Rep. 87, 106. Hershberger v. Blewett, 55 Fed. Rep. 170. Detroit v. Detroit City Railway, 55 Fed. Rep. 569. Stevens v. Railroads, 4 Fed. Rep. 97. Badger v. Badger, 1 Cliff. 237. Folger v. The Robert G. Shaw, 2 Woodb. & M. 531. Wilkinson v. Wilkinson, 2 R. I. 414. Cozzens v. Sisson, 5 R. I. 489. Where a plaintiff wishes to dismiss his bill as to a part of the relief prayed for, the proper way is to apply for leave to amend, by striking out. Camden Amboy Railroad v. Stewart, 4 C. E. Green, 69. This the plaintiff did, and his motion was denied. The defendant was therefore entitled to treat the claim now in suit as still a part of the matter to be heard and determined in that suit.
It does not necessarily follow, however, that the judgment in that case is a bar to the present suit. It has been held elsewhere, that, if a plaintiff sues in one action for several distinct demands, and obtains a general verdict and judgment, the record of such judgment is not conclusive evidence that all of the demands were included therein, and will not bar a subsequent action for such as in fact were not adjudicated upon. Seddon v. Tutop, 6 T. R. 607. Paine v. Schenectady Ins. Co. 12 R. I. 440. Hungerford’s appeal, 41 Conn. 322. Supples v. Cannon, 44 Conn. 424. Allebaugh v. Coakley, 75 Va. 628. Wheeler v. Van Houten, 12 Johns. 311, dictum. This question was discussed, but not decided, in Goodrich v. Yale, 8 Allen, 454, where it was said that the doctrine of Seddon v. Tutop “ is not entirely free from objection, inasmuch as it allows a party unnecessarily to subject.the other party to a second suit, after the plaintiff has elected to unite two causes of action in one suit, and when he has had full opportunity to obtain judgment for his entire damages.” The court, however, was not ready to deny the doctrine of that decision, and, upon consideration, we think it better not to extend the estoppel of a former judgment so far as to assume conclusively that such a distinct demand was determined in favor of the defendant, when the record does not so state, but merely shows that the other demands were deter*226mined in favor of the plaintiff, Such estoppel includes whatever wag actually determined, and whatever was necessarily involved in the actual determination; but where the former action included several distinct claims or demands, which were distinct causes of action, a demand or cause of action which in point of fact was not passed upon may be the subject of a subsequent suit. The defendant might have brought such demand to the attention of the court, and might have asked for and obtained an adjudication upon it. But if this was not done, and if there was no such adjudication, then there is no estoppel in respect to it. This limitation of the doctrine of estoppel by former judgment is in accordance with the general tendency of the decisions. Foye v. Patch, 132 Mass. 105. Hooker v. Hubbard, 102 Mass. 239, 245. Burlen v. Shannon, 99 Mass. 200. Russell v. Place, 94 U. S. 606. De Sollar v. Hanscome, 158 U. S. 216, 221. Dunlap v. Glidden, 34 Maine, 517. Pray v. Hegeman, 98 N. Y. 351. Doe v. Oliver, 2 Smith’s Lead. Cas. (7th Am. ed.) 699, and cases cited.
The demand now in suit, therefore, is not barred by the former judgment, unless it was in fact adjudicated upon therein; and the record laid before us is not conclusive evidence that it was so adjudicated upon. If there is any question as to. the fact, it will be determined in the Superior Court.
Unless in point of fact it was so adjudicated, the plaintiff should have a decree for $3,010.68, and interest.
Ordered accordingly.
Holmes, J.In my opinion, when the pleadings present three issues, and the final decree is for the plaintiff upon two of them and is silent as to the third, it has the same effect, with regard to that issue, as if it had been expressly for the defendant. Thompson v. McKay, 41 Cal. 221, 227. In either form, it is a bar to a subsequent suit for the same cause of action. Schmidt v. Zahensdorf, 30 Iowa, 498. Decisions as to the effect of the decree as an estoppel in collateral proceedings have no application. See Foye v. Patch, 132 Mass. 105, 110; Bassett v. Connecticut River Railroad, 150 Mass. 178; Bradley v. Bradley, 160 Mass. 258 ; Watts v. Watts, 160 Mass. 464, 465 ; Cromwell v. County of Sac, 94 U. S. 351, 352; Pray v. Hegeman, 98 N. Y. 351.
Justices Knowlton and Lathrop concur in this view.