McClain, J.
1 A demurrer was sustained to plaintiff’s original petition, and leave was given to amend. After amendment a demurrer was again sustained to the petition as -amended, and plaintiff was again given leave to amend. Thereafter plaintiff filed a pleading denominated an “amended and substituted petition” setting out a different cause of action and asking different relief from that stated in her previous pleadings. Defendant then demurred “to the original petition of the plaintiff, and the several amendments and substitution thereof, for the following reason: That the facts stated therein do not entitle the plaintiff to the relief demanded.” This demurrer was sustained, and judgment was entered against the plaintiff for costs. The judgment entry recites that, the demurrer ruled on “being the third demurrer sustained, plaintiff’s action is dismissed.”
*5232 3 4 *522In the first place, it is contrary to- the practice in this state to render final judgment as the result of a ruling sustaining a demurrer, without any election on the part of the party whose pleading is held insufficient to stand on such pleading. The theory of the court seems to have been that, in view of the previous opportunities for amendment, it would have been proper to refuse leave to amend, and therefore that judgment against plaintiff could properly be entered. The correctness of this view is not specifically argued, and we do not malee any ruling thereon; but, as the question confronts us in the record, we do not feel at liberty to pass it without some reference. In general, judgment goes against the party whose pleading is held insufficient on demurrer only when he elects to stand on his pleading, or when, having asked leave to amend, he is in default for not doing so. See Code, section 3188, and notes to section 3565. The leave granted after the sustaining of the second demurrer was to amend. Plaintiff, instead of amending, filed a substituted petition. Whether, under leave to amend, plaintiff had the absolute right to file a sub*523stituted pleading setting up a different cause of action, we need not determine. That question could have been raised by motion to strike the substituted petition, and could only be raised in that way. The objection could not be considered in ruling on a demurrer, which must necessarily go to the sufficiency of the pleading itself, and not to the right of a party to file it. The demurrer should have been overruled because the defendant attempted thereby to have the court consider not only the averments of the substituted petition, but also those of the original petition and amendments thereto. A substituted pleading supersedes previous pleadings by the same party, and a demurrer to such pleading must be determined on the sufficiency of its averments alone. The fact that these averments are inconsistent with the averments- of the previous pleadings is not- a ground of demurrer, and .should not be made the basis of attack on the new pleading. It was not necessary for plaintiff to dismiss her first petition in order to prevent its being considered in connection with the substituted petition. Mowry v. Wareham, 101 Iowa, 28. State v. Simpkins, 77 Iowa, 676. It is true that the pleadings superseded remain a part of the record, but they cannot be read or commented on in the trial of the case unless formally introduced in evidence. ' Shipley v. Reasoner, 87 Iowa, 555; Leach v. Hill, 97 Iowa, 81. And certainly they cannot be made the basis of an attack on the substituted pleading. The substantial error of the lower court was in considering the former pleadings in ruling on a demurrer to the substitute. If plaintiff had no right to file a substituted pleading, it should have been stricken out on motion. And the same remedy should have been pursued if it was claimed that it was sham or frivolous. Code, section 3618. These objections cannot be interposed by a demurrer. It ought not be difficult for counsel to raise all proper objecions to pleadings by -'the adverse party and *524have tbe proper rules pf procedure observed, without asking the trial court to violate the perfectly simple and fundamental principles in accordance with which issues of law or fact must be joined in that court.
5 Counsel for appellees question the sufficiency of the assignment of the error complained of by appellant, but that assignment refers directly to the sustaining of defendant’s demurrer to> plaintiff’s amended and substituted petition. As this demurrer consisted simply of the general statement (permissible in equity' actions) that plaintiff’s pleadings did not state facts entitling plaintiff to the relief demanded, we cannot see how the assignment could have been more specific.
6 Suggestion is made by appellees with reference to the death of appellant since the appeal was taken. The substitution of proper parties may be made when asked, but tlie death of a party does not prevent the determination of the appeal. Code, ■ section 4150. Proper substitution can in this case be made in the lower court in connection with further proceedings. — Reversed.