
36 Cal.2d 493 (1950)
GOLDA J. NUNNELEY, Respondent,
v.
EDGAR HOTEL et al., Appellants.
L. A. No. 21454. 
Supreme Court of California. In Bank.  
Dec. 19, 1950.
 Forgy, Reinhaus & Forgy, Arthur M. Bradley and Stanley M. Reinhaus for Appellants.
 Harvey, Rimel & Johnston and Fred D. Johnston for Respondent.
 EDMONDS, J.
 A jury awarded Golda J. Nunneley substantial damages for personal injuries sustained by her when she fell down a shaft opening onto the roof of a hotel building. The appeal from the judgment in her favor presents for decision questions as to the sufficiency of the evidence to support the verdict, the construction of section 16827 of the Health and Safety Code, and the propriety of certain instructions based upon that statute.
 The chain of events which led to the accident commenced at a bar where Miss Nunneley met two Marine Corps sergeants. After a festive afternoon during which the group had a few drinks, she accompanied them to their rooms on the fourth floor of the Edgar Hotel. The rooms on this floor did not cover the entire area of the structure, and from the hallway one could walk onto the roof of the third floor.
 The record includes evidence that by signs posted in conspicuous places, guests were warned to keep off the roof. According to other testimony, there had been added to cards posted in several rooms stating the hotel rules, a typewritten notice which read: "Stay off roof--No guests or persons allowed on roof of hotel." Miss Nunneley and one of the *495 marines told the jury that the lights in the hallway were dim, and they saw no such signs. Three police officers who investigated the accident did not recall seeing any signs.
 There is also testimony which may be summarized as follows: Miss Nunneley and the sergeants each had one drink in the hotel room, but did not finish it. None of the group was intoxicated. In the company of one of her companions, Miss Nunneley stepped out of the hallway onto the roof of the building. The door to the roof was open, and nothing but a small ledge impeded the exit. The only light on the roof was from the street lights or from adjacent buildings.
 The couple walked on the roof until they came to a mattress which appeared to them to be resting on what looked like "a flat top or another little roof like a little house." However, this was the opening of a shaft which extended vertically downward for a distance of approximately two stories. No lights could be seen coming from the shaft. The shaft, 68 inches wide, was surrounded by a parapet 27 inches high at the point where the mattress rested. The mattress was 72 inches in length. Using the Marine Corps term for a bed, Miss Nunneley said, "Here is a sack. ... I think I will sit on it." She did so and fell to the bottom of the shaft receiving serious injuries.
 The manager of the hotel testified that he had placed the mattress upon the springs of an old bed which was on the roof. He said that he did not know it had been moved to the top of the shaft and could not explain how it got there.
 By the first count of her complaint, Miss Nunneley alleged general negligence on the part of Gladys P. Brickel, the owner of the hotel, and Charles F. Brickel, her husband, who was the manager of it. Her pleading declared that there were no warning signs of the danger upon the roof, nor was there adequate lighting. It also charged that, with the knowledge of the defendants, the mattress was left upon what appeared to be a solid foundation. In a second count, Miss Nunneley asserted that the defendants were negligent in that a "vent shaft," surrounded by a parapet less than 30 inches in height, was maintained contrary to the provisions of section 16827 of the Health and Safety Code.
 The jury returned a general verdict in favor of the plaintiff without reference to the two counts in the complaint. A motion for a new trial was denied.
 As ground for reversal of the judgment, the Brickels assert *496 that certain instructions given to the jury were prejudicially erroneous. In support of this contention, it is insisted that the provisions of the Health and Safety Code which were a part of the charge do not apply to the hotel because the statute was enacted after the building was erected, and does not purport to apply retroactively. Furthermore, it is argued, even if the code section applies retroactively, the opening into which Miss Nunneley fell is not a vent shaft within the meaning of that term as used by the Legislature. The action of the court in allowing the jury, at Miss Nunneley's request, to view the premises, is also challenged. The appellants assert that the premises were not in the same condition at the time of trial as at the date of the accident.
 Miss Nunneley declares that in the light of its legislative purpose and express terms, the provisions of the Health and Safety Code upon which she relies are applicable to her cause of action. With regard to the term "vent shaft," a liberal construction of the statute designed to minimize the hazards caused by open shafts would give her the benefits of its provisions. In any event, it is said, her complaint refers to "vent shaft," and the answer of the Brickels accepts that term and fails to deny that it was such an opening. In addition, she points to the record, which shows that the words "vent shaft" and "light well" were used interchangeably throughout the trial by counsel for both parties.
 Other points relied upon in support of the judgment are that the instructions attacked by the appellants could not be prejudicially erroneous as far as the judgment against Charles F. Brickel is concerned because, by their terms, they are not directed to any conduct by him. Furthermore, the complaint is in two counts and a general verdict was returned without mention of either of them. Miss Nunneley also argues that, because the Brickels did not question the form of the verdict, nor request submission of special issues to the jury, the challenged instructions are not prejudicially erroneous if the evidence upon either count will sustain the general verdict. Another point relied upon is the contention that if the Brickels wished to have the jury informed as to the legal difference between a "vent shaft" and a "light well," it was their duty to offer appropriate instructions. As they did not do so, she says, they are not in a position to complain that the jury was not properly charged.
 [1] Assuming, but not deciding, that by maintaining a parapet less than 30 inches in height around an open shaft *497 the owner of the Edgar Hotel violated section 16827 of the Health and Safety Code, Miss Nunneley may not recover damages based upon such violation unless she is one of the class of persons for whose benefit the statute was enacted. She must also prove that the accident was of the nature which the statute was designed to prevent, and present proof of violation of the statute as the proximate cause of her injury.
 Not every infraction of a statute will result in civil liability. "Many statutes, such as those directed against various activities on Sunday, obviously are intended to protect the interests of the state, or the community at large, rather than those of any particular class of individuals." (Prosser, Torts, p. 266.) It follows that violation of such a statute constitutes actionable negligence only as to those persons for whose benefit or protection the statute was enacted. (Routh v. Quinn, 20 Cal.2d 488 [127 P.2d 1, 149 A.L.R. 215]; King v. San Diego Elec. R. Co., 176 Cal. 266 [168 P. 131]; and see 19 Cal.Jur. p. 635.) But clearly section 16827 of the Health and Safety Code was enacted for the protection of any person lawfully on or about the premises, and Miss Nunneley came within that category.
 However, there is the additional issue of whether the purpose of the statutory requirement for a 30-inch parapet is to protect one from the type of accident which is shown by the record in this case. Violation of a legislative enactment by failing to do a required act results in liability only if "... the harm which the violation causes is that from which it was the purpose of the enactment to protect. ..." (Rest., Torts,  286, comment on clause c.)
 A well known case in which this rule was applied is Gorris v. Scott, 9 Ex. 125, L.R. 1874, which concerned a statute specifying the minimum size of pens upon vessels transporting animals across the ocean. The purpose of the legislation was to prevent sickness likely to result from overcrowding. The plaintiff's sheep were lost during a storm. It was held that the failure of the shipowner to provide pens did not constitute actionable negligence because loss of the sheep by being washed overboard during the storm "... was not contemplated at all by the statute. ..."
 More in point is Indiana & Chicago Coal Co. v. Neal, 166 Ind. 458 [77 N.E. 850, 9 Ann.Cas. 424], which concerned a driver of a coal car who was injured while opening the door to the mine. In violation of a statute, no person had been *498 designated to open and close the door. Recovery was denied because the purpose of the statute was to prevent interference with circulation of air and not to guard against injury received by a person who opened such a door.
 The same conclusion was reached in Flynn v. Gordon, 86 N.H. 198, 200 [165 A. 715], where the court said: "The violation of a statute or ordinance becomes an actionable wrong only when the consequences contemplated by the provision in question have actually resulted from its violation. If none of the consequences which the enactment was designed to guard against have resulted from its breach, such a breach does not constitute an actionable wrong even though some other injurious consequence has resulted. It is not enough for a plaintiff to show that the defendant neglected a duty imposed by statute and that he would not have been injured if the duty had been performed. He must go further and show that his injury was caused by his exposure to a hazard from which it was the purpose of the statute to protect him." The decisions of this court are to the same effect. (Satterlee v. Orange Glen School Dist., 29 Cal.2d 581 [177 P.2d 279]; Harris v. Joffe, 28 Cal.2d 418 [170 P.2d 454].)
 [2, 3] Obviously, the statute upon which Miss Nunneley relies was not enacted for the purpose of protecting her against the type of hazard she encountered. The manifest intention of the Legislature in specifying a minimum height of 30 inches for the parapet of every vent shaft in the roof of an apartment house or hotel was to protect a person lawfully upon the premises from walking or stumbling into the opening. Upon no reasonable theory may it be said that the legislation was designed to guard one from the danger of falling into a shaft by reason of sitting upon the parapet. A wall 30 inches in height presents no more obstacle to sitting upon it than one three inches lower.
 Furthermore, no liability can be predicated upon noncompliance with a statutory command if the act or omission had no causal connection with the plaintiff's injury. (Blodgett v. B. H. Dyas Co., 4 Cal.2d 511, 513 [50 P.2d 801]; Wohlenberg v. Malcewicz, 56 Cal.App.2d 508, 512 [133 P.2d 12].) Otherwise stated, "... the act or omission must proximately cause or contribute to the injury." (Hitson v. Dwyer, 61 Cal.App.2d 803, 808 [143 P.2d 952].) In the Blodgett case, the plaintiff sustained injury from falling down a stairway which, in violation of an ordinance, was not equipped with a center handrail. In affirming a judgment of nonsuit the court said: *499 "The evidence shows that the lack of the handrail was neither the proximate nor any cause of plaintiff's fall. Any violation of the ordinance by the defendant would, therefore, be immaterial."
 The decision in Burtt v. Bank of California Nat. Assn., 211 Cal. 548 [296 P. 68], was based upon the same principle. There the plaintiff charged that the collapse of a building resulted from noncompliance with certain building requirements. In denying recovery, it was held: "Even though the structure failed to comply with the building laws, the trial court might reasonably conclude, as it did, that the sole, proximate cause of the damage ... was appellant's negligence in unreasonably and excessively overloading the building, and that such injury and damage would have resulted from such overloading even if the structure had satisfied all building law requirements." To the same effect are: Dewhirst v. Leopold, 194 Cal. 424 [229 P. 30]; Williams v. Southern Pacific Co., 173 Cal. 525 [160 P. 660]; Thomas v. German Gen. etc. Soc., 168 Cal. 183 [141 P. 1186] (defendant had not complied with an ordinance requiring automatic closing devices, but the negligence of a fellow servant in moving the elevator was held to be the proximate cause of plaintiff's injuries); Kauffman v. Machin Shirt Co., 167 Cal. 506 [140 P. 15]; Skaggs v. Wiley, 108 Cal.App. 429 [292 P. 132] (statutory requirement as to speed of vehicle must be the proximate cause of the accident); Provin v. Continental Oil Co., 49 Cal.App.2d 417 [121 P.2d 740] (improper construction of loading rack not the proximate cause of collision on highway where tank truck made a U-turn after backing from the loading rack).
 Unquestionably, the cause of Miss Nunneley's injuries was not the fact that the parapet was three inches lower than required by statute. No evidence was offered to prove that had the wall been 30 inches in height the mattress would not have been placed upon it, or that at the higher level the dangerous condition would have been more apparent. Nevertheless, the jury was instructed as follows: "Health and Safety Code, sec. 16827. Parapet or rail at roof line. 'A parapet or rail at least thirty inches in height shall be constructed at the roof line of every vent shaft in an apartment house or hotel so that no person may walk or fall into the shaft.' Conduct which is in violation of Section 16827 just read to you constitutes Negligence per se." (Instruction 15.) "If you find that defendant Gladys Peterson Brickel violated the *500 statute requiring the parapet around the light well to be of minimum height, her negligence is thereby established. But before plaintiff may recover you must further find that the negligence of such defendant was the proximate cause of plaintiff's injury and that plaintiff was not guilty of contributory negligence and that plaintiff was an invitee (or licensee) as to the part of the premises where she was injured." (Instruction 30.)
 For the reasons stated, these instructions should not have been given. [4a] However, Miss Nunneley contends that when a complaint is in two or more counts and the evidence is sufficient to sustain a judgment upon one of them, error which affects the other count is immaterial. She relies upon Shields v. Oxnard Harbor Dist., 46 Cal.App.2d 477, 491 [116 P.2d 121], in which the court said: "A general verdict imports findings in favor of the prevailing party on all material issues and, if there is substantial evidence to sustain a verdict on one count which is unaffected by error, the fact that there is not sufficient evidence to sustain the necessary findings of fact upon another count to support a verdict, or that there have been errors in connection with such other count, will not justify a reversal of the general verdict."
 The instructions make no distinction between the two counts of the complaint. In the first count it was alleged, among other facts stated as establishing general negligence, that the Brickels maintained a vent shaft only 27 inches in height. In the second count, Miss Nunneley asserted that, contrary to the provisions of the Health and Safety Code, the parapet was less than 30 inches in height. The instruction that if Gladys Peterson Brickel violated the statute "... her negligence is thereby established ..." is applicable to the evidence presented as tending to prove the cause of action pleaded in either count. For this reason, the Brickels contend that, although the jury found against both the owner and the manager of the hotel, there is no way of determining whether responsibility was laid upon each of them because of general negligence, or violation of the statute.
 However, the instructions relating to the provisions of the Health and Safety Code referred only to the conduct of Gladys Peterson Brickel. [5] It must be assumed that the jury understood the instructions and correctly applied them to the evidence. (Henderson v. Los Angeles Traction Co., 150 Cal. 689 [89 P. 976]; Dermer v. Pistoresi, 109 Cal.App. 310 [293 P. 78]; Robinson v. McKnight, 103 Cal.App. 718 [284 P. *501 1056].) It follows that the verdict against Charles F. Brickel, the manager of the hotel, was based upon the evidence relating to general negligence. [4b] There is no contention that the evidence in that regard is insufficient to support a verdict against either of the Brickels. Therefore, the implied finding of general negligence upon the part of Charles F. Brickel, being supported by the evidence and unaffected by the instructions concerning the requirements of the Health and Safety Code, fully justifies the verdict and judgment against him.
 The evidence of general negligence is also sufficient to establish the liability of Gladys Peterson Brickel, as the owner of the property. Otherwise stated, the jury could have found Mrs. Brickel liable for the injuries sustained by Miss Nunneley upon the cause of action for general negligence, the evidence as to that charge being applicable to her conduct as well as to that of her husband. Under these circumstances, the giving of Instructions 15 and 30 did not result in a miscarriage of justice. (Cal. Const., art. VI,  4 1/2.)
 [6] The ground of attack upon the order allowing the jurors to view the place where the accident occurred is that they might have found the appellants guilty of negligence because barricades and supporting pipes had since been placed around the top of the roof. However, when inspecting the premises the trial judge told the jurors: "This is the roof that has been referred to, ... and there are some changes since the time of the accident. Those changes are to be entirely disregarded by you. They have nothing whatsoever to do with the accident." After pointing out the changes which had been made, he continued, "The fact that any changes have been made does not mean that there is any intimation upon the part of the defendants or any of them, that the condition was dangerous at the time of the accident, nor to be considered by you for any purpose whatsoever. You are to consider the condition as it existed at the time of the accident. ... Is that clear to all of you? The jurors replied in the affirmative."
 The question as to whether the jury should be allowed to view the premises where an accident occurred is governed by section 610 of the Code of Civil Procedure, and is committed to the sound discretion of the trial judge. An appellate court will not reverse a judgment because of a ruling in that regard unless the record clearly shows an abuse of that *502 discretion. (Brown v. Lemon Cove Ditch Co., 36 Cal.App. 94 [171 P. 705]; see, also, People v. Pompa, 192 Cal. 412, 422 [221 P. 198].) In the present case the order allowing inspection of the roof was fully justified and the rights of the appellants were carefully protected.
 The judgment is affirmed.
 Gibson, C.J., Shenk, J., and Schauer, J., concurred.
 Carter, J., concurred in the judgment.
 TRAYNOR, J.
 I dissent.
 I agree that the trial court's instructions concerning negligence per se were erroneous. I do not agree, however, that the error was not prejudicial.
 If there are two independent grounds upon which a verdict may have been based, erroneous instructions as to one ground will not justify reversal if it clearly appears that the verdict was based upon the other ground. (Oettinger v. Stewart, 24 Cal.2d 133, 140 [148 P.2d 19, 156 A.L.R. 1221].) Thus, there need be no reversal if such other ground is established as a matter of law (Clement v. State Reclamation Board, 35 Cal.2d 628, 643 [220 P.2d 897]), as, for example, by "facts that are admitted as proved beyond controversy" (O'Meara v. Swortfiguer, 191 Cal. 12, 17 [214 P. 975]). If the evidence with respect to such other ground is substantially in conflict, however, it is impossible to determine whether the jury based its verdict thereon or relied instead upon the ground upon which they were erroneously instructed. It is settled that in such a case the error is prejudicial. (Young v. Southern Pacific Co., 182 Cal. 369 [190 P. 36]; O'Meara v. Swortfiguer, 191 Cal. 12 [214 P. 975]; Oettinger v. Stewart, 24 Cal.2d 133 [148 P.2d 19, 156 A.L.R. 1221]; Huebotter v. Follett, 27 Cal.2d 765 [167 P.2d 193]; Edwards v. Freeman, 34 Cal.2d 589 [212 P.2d 883]; Clement v. State Reclamation Board, 35 Cal.2d 628 [220 P.2d 897]; Galloway v. United Railroads, 69 Cal.App. 770 [232 P. 491]; Criswell v. Pacific Electric Railway Co., 48 Cal.App.2d 819 [120 P.2d 670].)
 In the present case, although the issue of negligence per se was improperly submitted to the jury, there was evidence of other negligence which, if believed, would support a verdict for the plaintiff. The other alleged acts of negligence were inadequate lighting, improper placement of the mattress over the vent shaft, and absence of warning signs. As to each of them, however, there was a sharp conflict in the evidence. *503 The jury may have rejected these claims of negligence and relied solely upon the court's instructions that the height of the parapet constituted negligence per se. Under these circumstances, we should reverse the judgment.
 It is contended, however, that the instructions concerning negligence per se referred only to Mrs. Brickel and that it necessarily follows from the verdict against Mr. Brickel that the jury found him guilty of general negligence. It is argued further that since he was the manager of the hotel and acting within the scope of his employment, his negligence is imputed to his principal, Mrs. Brickel, so that she too can be held liable without reliance on negligence per se.
 An examination of the erroneous instructions reveals that they did not refer to Mrs. Brickel exclusively.
 Instruction No. 15 reads as follows: "Health and Safety Code, 16827. Parapet or rail at roof line. 'A parapet or rail at least thirty inches in height shall be constructed at the roof line of every vent shaft in an apartment house or hotel so that no person may walk or fall into the shaft.' Conduct which is in violation of Section 16827 just read to you constitutes negligence per se."
 Instruction No. 30 reads as follows: "If you find that defendant Gladys Peterson Brickel violated the statute requiring the parapet around the light well to be of minimum height, her negligence is thereby established. But before plaintiff may recover you must further find that the negligence of such defendant was the proximate cause of plaintiff's injury and that plaintiff was not guilty of contributory negligence and that plaintiff was an invitee as to the part of the premises where she was injured."
 Clearly No. 15 is not limited to Mrs. Brickel, and No. 30, while referring only to her, does not exclude Mr. Brickel and may be viewed as illustrative of the way in which No. 15 was meant to be applied. There is nothing in the pleadings, in the evidence, or elsewhere in the instructions to the jury to suggest that plaintiff or the trial court considered Mr. Brickel to be any less responsible for the violation of the statute than Mrs. Brickel. Neither of the defendants constructed the building, and therefore the statute could apply only to the operation of the hotel--conduct for which Mr. Brickel, as manager, was as responsible as his wife (Restatement, Agency,  355), and the complaint was so framed.
 If the trial court had charged that "residing in Santa *504 Ana is negligence per se," the error would have affected both defendants. This error would not be corrected as to Mr. Brickel by a later instruction that "if you find that defendant Gladys Peterson Brickel resides in Santa Ana, her negligence is thereby established" -- such an instruction would serve rather to illustrate the general rule already given. The instructions in the present case are analogous, and it must be concluded that both defendants were prejudicially affected by them.
 Spence, J., concurred.
