
150 Cal.App.2d 296 (1957)
L. W. HARRISON, Appellant,
v.
BUTTE STEEL BUILDINGS, INC. (a Corporation) et al., Respondents.
Civ. No. 9011. 
California Court of Appeals. Third Dist.  
Apr. 18, 1957.
 Leander W. Pitman for Appellant.
 Dally & Saulque and Richard E. Saulque for Respondents.
 SCHOTTKY, J.
 Plaintiff, L. W. Harrison, commenced an action to recover the balance due on oral contract between plaintiff and defendants Butte Steel Buildings, Inc., a corporation, Butte Steel Buildings, Inc., a copartnership, and Butte Steel and Construction Company, a corporation, for the furnishing of labor and material in the construction of a grandstand, for payment of which defendant New Amsterdam Casualty Company obligated itself by the execution of a labor and material bond.
 On April 2, 1953, defendant Butte Steel Buildings, Inc., entered into a contract with the county of Trinity for the construction of a grandstand at the Trinity County Fairgrounds, Hayfork, California.
 Defendants filed an answer denying the material allegation of the complaint, and also setting up the separate defense that the general building contractor license issued to plaintiff was suspended for a period commencing January 19, 1953, and ending May 19, 1953. Defendant Butte Steel Buildings, Inc., also set up a counterclaim alleging damages by reason of plaintiff's failure to perform the contract, and asking for attorney's fees for defending the action commenced by plaintiff.
 At the opening of the trial the following occurred:
 "The Court: At the threshold of this proceeding, we have a preliminary problem which I have already discussed informally with counsel, concerning the factual and legal situation growing out of this contractor license problem. As I understand it, the contract involved in this case was entered into about the 3rd of April 1953. It is alleged in the answer and cross- complaint that work started on April 15, 1953 and it is further alleged that the plaintiff's license as a contractor was suspended from January 1953 to the 19th day of May 1953. Is there a dispute as to those allegations?"
 "Mr. Pitman [attorney for plaintiff]: The only dispute would be the date of 18th, would be April 19, your honor."
 "The Court: Well, if that is true, then we have a period of about five weeks when the contract was being performed *298 when the plaintiff had no license. Is that an admitted fact?"
 "Mr. Pitman: It is admitted, your honor, that from the time, April 3, 1953, until May 19th, 1953, the plaintiff's license was suspended."
 "The Court: Then if I understand your statement, there was a period of about five weeks when the work was being carried on and labor and materials were being furnished when the plaintiff was operating under a contract and had no license."
 "Mr. Pitman: It is true that his license was suspended. As having no license, that is correct, your honor."
 "The Court: Well, if it was suspended, he had no license. There is no question about those facts?"
 "Mr. Pitman: No question whatsoever."
 It was stipulated that plaintiff finished the concrete work on the grandstand on May 18, 1953, and received $3,300 in payment from respondent. From May 19, 1953, to August 26, 1953, while plaintiff possessed a valid contractor's license, he furnished labor and materials for the construction of said grandstand for respondents and completed same on August 26, 1953.
 Upon this statement of fact, the trial court called for argument upon the proposition of whether or not the appellant had any standing in court under such circumstances, and refused to take testimony. Before the trial court reached a decision, appellant moved for an order to reopen the cause to permit the taking of testimony, but this motion was denied. Thereafter, the court rendered judgment for the respondents upon the ground that appellant had no power to enter into a contract, that appellant had not proved that he was a duly licensed contractor at all times during the performance of the contract, and that the contract sued upon was an illegal contract under section 7031 of the Business and Professions Code which provides:
 "No person engaged in the business or acting in the capacity of a contractor, may bring or maintain any action in any court of this State for the collection of compensation for the performance of any act or contract for which a license is required by this chapter without alleging and proving that he was a duly licensed contractor at all times during the performance of such act or contract."
 The judgment also awarded defendants $500 attorney's fees upon their cross-complaint, said cross-complaint having been dismissed by defendants as to damages. *299
 Appellant has appealed from the judgment and the principal question involved in the appeal is whether or not appellant is precluded by the provisions of section 7031 of the Business and Professions Code from maintaining the instant action against respondents.
 Appellant makes a vigorous and able attack on the judgment, and contends that the contract involved in the instant case is valid and enforceable. He argues that appellant was not in pari delicto with respondent, that appellant has substantially complied with the state licensing requirements and that he was licensed as a contractor at the time the contract was performed and the cause of action arose; and that public policy will not be served by allowing respondents to retain for themselves the benefits of the services supplied them by appellant.
 Respondents in reply contend that the clear and unambiguous language of said section 7031 applies to the facts of the instant case and that said section clearly bars any recovery by appellant.
 Appellant has cited a number of cases which he argues support his contention, and respondents have also cited a number of cases in support of their position. It must be admitted that it is difficult to reconcile all of the authorities cited and that there seems to be some confusion in the authorities, but it would serve no useful purpose to review these authorities because since the trial of the instant case, and, indeed, since the oral argument in this court, our Supreme Court has rendered a decision in the case of Lewis & Queen v. N. M. Ball Sons, 48 Cal.2d 141 [308 P.2d 713], which we believe determines the issues involved upon this appeal. The facts as stated in the opinion were as follows:
 "Plaintiffs George W. Lewis and Paul C. Queen are engaged in the contracting business as the partnership of Lewis and Queen, hereinafter referred to as plaintiff. Defendant Ball Sons, hereinafter referred to as defendant, is also in the contracting business."
 "In June, 1949, defendant was awarded two contracts by the state, each contract for the construction of a separate section of the Hollywood Parkway. Defendant then entered into four contracts with plaintiff. With respect to the work to be done on each section of the parkway, there were two contracts between plaintiff and defendant. The first was entitled a 'subcontract,' and under it plaintiff agreed to remove concrete encountered during excavation of the roadway *300 and apply water needed in the process of compacting the ground. The second was entitled an 'equipment rental agreement,' and under it plaintiff agreed to provide defendant with construction equipment for road excavation, 'overhaul,' and compacting."
 "Plaintiff brought this action for damages for breach of the equipment rental agreements and for the reasonable rental value of equipment alleged to have been held beyond the agreed rental term. ... Defendant answered denying that it had breached the rental agreements, and filed a cross- complaint in which it alleged a breach of the agreements by plaintiff and sought to recover overpayments made to plaintiff. * * *"
 "The trial court concluded that plaintiff had agreed to act and had in fact acted as a contractor within the meaning of section 7026 of the Business and Professions Code, and that because it had done so without the license required by section 7028, it was barred by section 7031 from maintaining any action for compensation Lewis had an individual license, but neither Queen nor the partnership of Lewis and Queen had licenses. The court held, in the alternative, that the rental agreements were unenforceable because they violated the provisions in the state contracts against subcontracting more than a certain amount of the total work. Since we have concluded that plaintiff's failure to obtain a license prevented it from maintaining any action for compensation, we have no cause to consider this alternative ground. The court entered judgment for defendant on the complaint and for plaintiff on the cross-complaint. Plaintiff appeals from the judgment against it."
 In affirming the judgment, the Supreme Court, in the course of an exhaustive opinion in which earlier cases were reviewed, distinguished and in some instances disapproved, said at page 150:
 "Since plaintiff did not comply with the statute, it cannot 'bring or maintain any action in any court of this State for the collection of compensation. ...' ( 7031; Loving & Evans v. Blick, 33 Cal.2d 603 [204 P.2d 23].) Plaintiff contends, nevertheless, that because defendant has been paid in full by the state for all work done on the parkway, justice requires that it be compelled to turn over to plaintiff the proceeds from the state contracts attributable to plaintiff's labor."
 "One answer to this contention is that, even in the absence of a provision such as section 7031, the courts generally will *301 not enforce an illegal bargain or lend their assistance to a party who seeks compensation for an illegal act. The reason for this refusal is not that the courts are unaware of possible injustice between the parties, and that the defendant may be left in possession of some benefit he should in good conscience turn over to the plaintiff, but that this consideration is outweighed by the importance of deterring illegal conduct. Knowing that they will receive no help from the courts and must trust completely to each other's good faith, the parties are less likely to enter an illegal arrangement in the first place. (See Takeuchi v. Schmuck, 206 Cal. 782, 786-787 [276 P. 345]; May v. Herron, 127 Cal.App.2d 707, 712 [274 P.2d 484]; Orlinoff v. Campbell, 91 Cal.App.2d 382, 388 [205 P.2d 67]; Wise v. Radis, 74 Cal.App. 765, 778 [242 P. 90]; Grodecki, In Pari Delicto Potior Est Conditio Defendentis, 71 L.Q.Rev. 254, 266-268.)"
 "In some cases, on the other hand, the statute making the conduct illegal, in providing for a fine or administrative discipline excludes by implication the additional penalty involved in holding the illegal contract unenforceable; or effective deterrence is best realized by enforcing the plaintiff's claim rather than leaving the defendant in possession of the benefit; or the forfeiture resulting from unenforceability is disproportionately harsh considering the nature of the illegality. In each such case, how the aims of policy can best be achieved depends on the kind of illegality and the particular facts involved. (See Wilson v. Stearns, 123 Cal.App.2d 472, 481-482 [267 P.2d 59]; John E. Rosasco Creameries, Inc. v. Cohen, 276 N.Y. 274, 278-280 [11 N.E.2d 908, 118 A.L.R. 641]; 6 Corbin, Contracts 964-967 (1951); 2 Pomeroy, Equity Jurisprudence 137 (5th ed. 1941); Grodecki, In Pari Delicto Potior Est Conditio Defendentis, 71 L.Q.Rev. 254, 268.) But we are not free to weigh these considerations in the present case. Section 7031 represents a legislative determination that the importance of deterring unlicensed persons from engaging in the contracting business outweighs any harshness between the parties, and that such deterrence can best be realized by denying violators the right to maintain any action for compensation in the courts of the state. (Kirman v. Borzage, 65 Cal.App.2d 156, 158 [150 P.2d 3].)"
 The court said further at page 153:
 "It is true that when the Legislature enacts a statute forbidding certain conduct for the purpose of protecting one class of persons from the activities of another, a member of *302 the protected class may maintain an action notwithstanding the fact that he has shared in the illegal transaction. The protective purpose of the legislation is realized by allowing the plaintiff to maintain his action against a defendant within the class primarily to be deterred. In this situation it is said that the plaintiff is not in pari delicto. (Carter v. Seaboard Finance Co., 33 Cal.2d 564, 574 [203 P.2d 758]; McAllister v. Drapeau, 14 Cal.2d 102, 112 [92 P.2d 911, 125 A.L.R. 800]; Pollak v. Staunton, 210 Cal. 656, 662-663 [293 P. 26]; Elmers v. Shapiro, 91 Cal.App.2d 741, 754 [205 P.2d 1052]; see Grodecki, In Pari Delicto Potior Est Conditio Defendentis, 71 L.Q.Rev. 254, 265; Wade, Restitution of Benefits Acquired Through Illegal Transactions, 95 U.Pa.L.Rev. 261, 268-270.)"
 "But subcontractors are not always in the class to be protected simply because they are subcontractors, and we did not suggest otherwise in Fraenkel v. Bank of America, 40 Cal.2d 845, 848 [256 P.2d 569]. (See Albaugh v. Moss Constr. Co., 125 Cal.App.2d 126, 132 [269 P.2d 936]; Holm v. Bramwell, 20 Cal.App.2d 332 [67 P.2d 114].) The class protected by the statute includes those who deal with a person required by the statute to have a license. When the person required to have a license is a general contractor, then the protected class includes subcontractors, materialmen, employees, and owners dealing with the general contractor. However, when the person who was required to have a license but did not have one is himself a subcontractor, such as plaintiff in the present case, he of course is not to be protected from his own unlicensed activities. To allow him to recover would in fact destroy the protection of those who dealt with him, and they are in the class the Legislature intended to protect whether they are owners or general contractors. (Cf. Hedlund v. Sutter Medical Service Co., 51 Cal.App.2d 327, 333 [124 P.2d 878]; 2 Pomeroy, Equity Jurisprudence 142 (5th ed. 1941).) To the extent that it is contrary, the reasoning of Matchett v. Gould, 131 Cal.App.2d 821 [281 P.2d 524], is erroneous and is disapproved. Under the facts of the present case plaintiff is not in the class to be protected, and therefore is not relieved from the imputation of being in pari delicto. Its failure to obtain a license, and not any fault of defendant in this regard, made the transaction illegal."
 [1] As hereinbefore set forth the appellant entered into the contract with respondent for the furnishing of certain labor and materials for the building of the grandstand on *303 April 3, 1953, and began work on April 15, 1953. It was stipulated that appellant's license to act as a general building contractor was suspended from January 19, 1953, to May 19, 1953. Therefore, appellant did not and could not prove that he "was a duly licensed contractor at all times during the performance of such act or contract" as required by section 7031 of the Business and Professions Code hereinbefore quoted, and as a consequence appellant was precluded by the express terms of the section from maintaining any action for the collection of compensation for the performance of the contract.
 [2] The arguments advanced by appellant that respondents will be unjustly enriched and that public policy will not be served by allowing respondents to retain for themselves the benefits of the services supplied them by appellant, are all answered by the decision in Lewis & Queen v. N. M. Ball Sons, supra, which stated that: "Section 7031 represents a legislative determination that the importance of deterring unlicensed persons from engaging in the contracting business outweighs any harshness between the parties, and that such deterrence can best be realized by denying violators the right to maintain any action for compensation in the courts of the state." The plaintiff in that case was a subcontractor and the defendant was the contractor just as in the instant case appellant was the subcontractor and the respondent was the contractor. We are convinced that under the decision in the above-cited case the trial court correctly determined that appellant was not entitled to recover.
 The court did not err in refusing to reopen the case, as from the facts stipulated to in open court the unenforceability of the contract was apparent and no amount of further evidence could change the result. [3] As the court said in Loving & Evans v. Blick, 33 Cal.2d 603, 607 [204 P.2d 23]: " 'whenever the illegality appears, whether the evidence comes from one side or the other, the disclosure is fatal to the case.' [Citations.]"
 The judgment is affirmed.
 Van Dyke, P. J., and Peek, J., concurred.
