
700 N.W.2d 608 (2005)
270 Neb. 241
Joseph MOGLIA and Amy Moglia, husband and wife, appellants,
v.
McNEIL COMPANY, INC., et al., appellees.
No. S-04-554.
Supreme Court of Nebraska.
July 22, 2005.
*612 W. Patrick Betterman, Dave J. Skalka, and Jennifer M. Betterman, of Law Offices of W. Patrick Betterman, Omaha, for appellants.
Donald G. Furlow and Jason C. Demman, of Brodkey, Cuddigan, Peebles & Belmont, L.L.P., Omaha, for appellee Landgraphics, Inc.
Michael G. Mullin and Michaela A. Messenger, of McGrath, North, Mullin & Kratz, P.C., L.L.O., Omaha, for appellees K D Roofing, Inc., and Keith M. Duggan.
Michael T. Gibbons and Aimee C. Bataillon, of Woodke & Gibbons, P.C., L.L.O., Omaha, for appellees McNeil Company, Inc., and Patrick McNeil.
HENDRY, C.J., WRIGHT, CONNOLLY, GERRARD, McCORMACK, and MILLER-LERMAN, JJ.
MILLER-LERMAN, J.

NATURE OF CASE
Appellants, Joseph Moglia and Amy Moglia, sued various subcontractors and the contractor, claiming that their home was defectively constructed. Appellants were the second owners of the home. The amended complaint filed January 15, 2004, alleged three cause of action as follows: count I, "Breach of Implied Duty to Perform in a Workmanlike Manner"; count II, "Breach of Implied Warranty of Habitability"; and count III, "Negligence." All appellees filed motions to dismiss under Neb. Ct. R. of Pldg. in Civ. Actions 12(b)(6) (rev.2003). The district court granted the motions and dismissed the complaint. With the exception of the dismissal of count I, breach of implied duty to perform in a workmanlike manner alleged against the contractor, the McNeil Company, Inc., the district court did not err. We affirm in part, and in part reverse and remand for further proceedings.

STATEMENT OF FACTS
According to the complaint, in October 1994, the McNeil Company contracted with *613 Michael and Kathleen Fahey to design and build a house in Omaha, Nebraska. The construction concluded, and the Faheys took possession of the house on January 17, 1997. On August 1, 2001, appellants purchased the house from the Faheys. The Faheys are not parties to the instant litigation.
Appellants allege that beginning in December 2002 and continuing through October 2003, they discovered numerous defects in the design and construction of the house. Appellants specifically allege they first learned of roofing defects in December 2002 when they engaged a home inspector to inspect the premises for insurance purposes. They thereafter learned of drainage problems. Appellants allege that some or all defects violate the Omaha building codes.
On September 5, 2003, appellants filed suit against the contractor and several subcontractors who worked on the house. On January 15, 2004, appellants filed an amended complaint (complaint), naming as defendants the contractor, the McNeil Company, and Patrick McNeil, an employee of McNeil Company; the roofing subcontractor, K D Roofing, Inc., and Keith M. Duggan, an employee of K D Roofing; and the drainage subcontractor, Landgraphics, Inc. All defendants are appellees on appeal. The complaint contains three counts, asserted against various defendants, as follows: count I, "Breach of Implied Duty to Perform in a Workmanlike Manner," alleged against the McNeil Company, K D Roofing, Duggan, and Landgraphics; count II, "Breach of Implied Warranty of Habitability," alleged against the McNeil Company; and count III, "Negligence," alleged against all defendants. Appellants alleged they had sustained various damages and sought relief therefor.
In response to the allegations in appellants' complaint, each defendant filed a motion to dismiss under rule 12(b)(6), claiming that the complaint failed to state a claim upon which relief could be granted. The motions came on for hearing on April 6, 2004. In dismissing the complaint, the district court concluded that Nebraska did not recognize a cause of action for breach of an implied warranty of habitability. Thereafter, the district court concluded that all of appellants' claims sounded in contract and not in negligence. Finally, the district court determined that appellants lacked privity of contract with all of the defendant-appellees and that as such, the complaint failed to state a cause of action. The district court granted all appellees' motions and dismissed appellants' complaint with prejudice. Appellants filed this appeal.

ASSIGNMENT OF ERROR
Appellants claim that the district court erred in sustaining each appellee's motion to dismiss.

STANDARD OF REVIEW
The district court's grant of a motion to dismiss for failure to state a claim under rule 12(b)(6) is reviewed de novo, accepting all the allegations in the complaint as true and drawing all reasonable inferences in favor of the nonmoving party. Anderson v. Wells Fargo Fin. Accept., 269 Neb. 595, 694 N.W.2d 625 (2005).

ANALYSIS

Count I, Breach of Implied Duty to Perform in Workmanlike Manner, Was Properly Dismissed as to K D Roofing, Duggan, and Landgraphics but Was Improperly Dismissed as to McNeil Company.
Appellants allege in count I of the complaint that K D Roofing, Duggan, *614 Landgraphics, and the McNeil Company breached an implied duty to perform in a workmanlike manner. On appeal, appellants claim that the district court erred when it dismissed count I for failure to state a cause of action. As to K D Roofing, Duggan, and Landgraphics, we conclude the district court did not err in dismissing count I. However, we conclude that the district court erred in dismissing count I as to the McNeil Company.
With respect to K D Roofing, Duggan, and Landgraphics, we agree with the district court that in the absence of an allegation of privity, count I, styled "Breach of Implied Duty to Perform in a Workmanlike Manner," fails to state a cause of action against these subcontractors. We have long held that in the absence of an otherwise binding agreement, express or implied, there is no privity of contract between a subcontractor and the property owner who negotiated the original agreement with the general contractor. Boyd v. Benkelman Public Housing Authority, 188 Neb. 69, 195 N.W.2d 230 (1972). We have thus previously concluded that there is no liability on the part of subcontractors in favor of original owners, and given the more attenuated relationship with subcontractors, it logically follows that in the absence of privity, no liability on the part of subcontractors in favor of subsequent owners will be implied. See, Cox v. Curnutt, 271 P.2d 342 (Okla.1954); B & C Construction Co. v. Grain Handling Corp., 521 S.W.2d 98 (Tex.Civ.App. 1975).
In urging this court to extend the warranty of workmanlike performance in favor of subsequent owners despite the absence of privity, appellants refer us to several Nebraska cases, including Peterson v. North American Plant Breeders, 218 Neb. 258, 354 N.W.2d 625 (1984), and Herman v. Bonanza Blds., Inc., 223 Neb. 474, 390 N.W.2d 536 (1986). Peterson involved extending an implied warranty of merchantability to a subsequent purchaser of seed corn under the Uniform Commercial Code. Herman involved an action in which a steel building owner sued the manufacturer of a component part where the manufacturer had made express warranties upon which the owner relied. These cases are distinguishable from the case at bar. In the instant case, there are no Uniform Commercial Code imperatives and no alleged express warranties which would lead us to impose liability on the subcontractors in favor of the subsequent owners of the home based on the implied warranty to perform in a workmanlike manner. Given the absence of an allegation of privity, the district court did not err in dismissing count I as to K D Roofing, Duggan, and Landgraphics, and we affirm this portion of the district court's order.
Unlike subcontractors, as to contractors, we have long recognized that "[a]s a general rule a contractor constructing a building impliedly warrants that the building will be erected in a workmanlike manner. . . ." Henggeler v. Jindra, 191 Neb. 317, 318, 214 N.W.2d 925, 926 (1974). We note that the law implies the warranty, and we have applied this warranty between an original homeowner and a contractor. Id. This implied warranty "provides the owner with an action against the contractor if the contractor's work is not of good quality [and] free from defects." 3 C. Allen Foster et al., Construction and Design Law § 20.3a at 27 (1998). Appellants note that the ultimate objective encompassed by the warranty of workmanlike construction is the construction of a home of good quality and urge this court to extend the warranty such that it impliedly favors subsequent owners. We find merit in appellants' argument.
*615 Although we have not previously extended the warranty, we are aware that elsewhere, the warranty of workmanlike performance has explicitly been extended to subsequent purchasers. E.g., Aronsohn v. Mandara, 98 N.J. 92, 484 A.2d 675 (1984). Although using the language of the warranty of workmanlike construction and the warranty of habitability somewhat interchangeably, we are aware that both warranties have been extended in favor of subsequent purchasers by additional courts. E.g., Richards v. Powercraft Homes, Inc., 139 Ariz. 242, 678 P.2d 427 (1984); Keyes v. Guy Bailey Homes, Inc., 439 So.2d 670 (Miss.1983). But see, contra, Butler v. Caldwell & Cook, 122 A.D.2d 559, 505 N.Y.S.2d 288 (1986).
Various public policy rationale have been offered in extending the implied warranty of workmanlike performance in favor of subsequent purchasers. In explaining why the privity requirement should be abandoned between a subsequent purchaser and a contractor in connection with an implied warranty of workmanlike performance, the court in Aronsohn, supra, stated that to require privity
in such a situation would defeat the purpose of the implied warranty of good workmanship and could leave innocent homeowners without a remedy for negligently built structures in their home. The contractor should not be relieved of liability for unworkmanlike construction simply because of the fortuity that the property on which he did the construction has changed hands.
98 N.J. at 102, 484 A.2d at 680. As to the breadth of the warranty, we note that in Gupta v. Ritter Homes, Inc., 646 S.W.2d 168 (Tex.1983), overruled in relevant part in Amstadt v. U.S. Brass Corp., 919 S.W.2d 644 (Tex.1996), as recognized in PPG Industries v. JMB/Houston Centers, 146 S.W.3d 79 (Tex.2004), the warranty of workmanlike performance was extended to a subsequent owner under the Texas Deceptive Trade Practices Act, and, in so doing, the concurring opinion prudently suggested that such extension should be limited to latent defects which could not be discovered at the time of sale to the subsequent owner.
In Richards, supra, the court held that privity should not be required between a remote purchaser and a contractor with respect to "the implied warranty of workmanship and habitability." 139 Ariz. at 245, 678 P.2d at 430. The Richards court relied on a warranty of habitability case, Moxley v. Laramie Builders, Inc., 600 P.2d 733 (Wyo.1979), and stated that "`[t]he purpose of the warranty is to protect innocent purchasers and hold builders accountable for their work. With that object in mind, any reasoning which would arbitrarily interpose a first buyer as an obstruction to someone equally deserving of recovery is incomprehensible.'" 139 Ariz. at 245, 678 P.2d at 430 (quoting Moxley, supra). The Richards court explained that the policy considerations underlying the "implied warranty" in favor of original owners are equally applicable to subsequent homeowners. Those considerations include that "house-building is frequently undertaken on a large scale, that builders hold themselves out as skilled in the profession, that modern construction is complex and regulated by many governmental codes, and that homebuyers are generally not skilled or knowledgeable in construction, plumbing, or electrical requirements and practices." Richards, 139 Ariz. at 245, 678 P.2d at 430. The Richards court also noted that in a mobile society, homebuilders should anticipate the houses they construct will change ownership.
Upon due consideration, we agree that liability under the implied warranty *616 of workmanlike performance should be further implied and extended to subsequent home purchasers as against general contractors and that this extension should be circumscribed by certain limitations which we note other courts have adopted. E.g., Richards v. Powercraft Homes, Inc., 139 Ariz. 242, 678 P.2d 427 (1984). Our extension of liability is thus limited to latent defects which manifest themselves after the subsequent purchase and are not discoverable by the subsequent purchaser's reasonably prudent inspection at the time of the subsequent purchase. Such liability is further subject to the statute of limitations found at Neb.Rev.Stat. § 25-223 (Reissue 1995). In extending the implied warranty of workmanlike performance to subsequent purchasers as against contractors, we note that the subsequent owner has the burden, inter alia, of proving a latent defect which is attributable to the actions or inactions of the builder, and the builder retains the traditional defenses, affirmative and otherwise.
Given our conclusion that the implied warranty of workmanlike performance extends in favor of subsequent purchasers against contractors with the limitations noted above, and drawing all reasonable inferences in the complaint in favor of appellants, we conclude that the district court erred in dismissing count I as to the McNeil Company. This portion of the district court's order is reversed, and the cause remanded for further proceedings.

Count II, Breach of Implied Warranty of Habitability Was Properly Dismissed.
Appellants allege in count II of the complaint that the McNeil Company breached an implied warranty of habitability. On appeal, appellants claim that the district court erred when it dismissed count II for failure to state a cause of action. We conclude the district court did not err in dismissing count II.
It has been stated that
the basic elements of the implied warranty of habitability are that it applies to purchasers of residences against builders and ensures that there are no defects in materials or workmanship that make a dwelling unfit for habitation. . . .
The premise behind the warranty is that every contract to erect a structure contains an implied warranty that the structure shall be fit to live in.
3 C. Allen Foster et al., Construction and Design Law § 20.4a at 44 (1998).
Relying primarily on language found in Lange Indus. v. Hallam Grain Co., 244 Neb. 465, 507 N.W.2d 465 (1993), and Henggeler v. Jindra, 191 Neb. 317, 214 N.W.2d 925 (1974), appellants assert that Nebraska has indicated its approval of a cause of action based on implied warranty of habitability. On appeal, appellants argue that we should extend such purported cause of action in favor of subsequent owners such as appellants. However, contrary to appellants' reading of Lange and Henggeler, Nebraska has not adopted a cause of action based on implied warranty of habitability. The cases cited by appellants involved issues pertaining to whether the structures had been constructed in a workmanlike manner, and the language on which appellants rely was merely incidental to the decisions therein. See, similarly, Eliker v. Chief Indus., 243 Neb. 275, 498 N.W.2d 564 (1993).
We are aware that the implied warranty of habitability has been adopted by a great many states and extended to subsequent owners. E.g., Redarowicz v. Ohlendorf, 92 Ill.2d 171, 441 N.E.2d 324, 65 Ill.Dec. 411 (1982); Moxley v. Laramie Builders, Inc., 600 P.2d 733 (Wyo.1979). We are also aware of authority to the contrary. E.g., *617 Arvai v. Shaw, 289 S.C. 161, 345 S.E.2d 715 (1986).
In a case describing the implied warranty of habitability, it has been observed that "[h]abitability is synonymous with suitability for living purposes; the home must be occupiable." Aronsohn v. Mandara, 98 N.J. 92, 104, 484 A.2d 675, 681 (1984). In the instant case, there are numerous allegations describing defects in the house, but there are no allegations in the complaint which could fairly be taken to allege that the house is not fit for habitation. Given the allegations in the complaint and given the state of the law in Nebraska where we have not recognized an implied warranty of habitability in favor of original owners, we are not inclined to adopt such cause of action in the first instance in favor of subsequent purchasers. The district court did not err in dismissing count II alleged only against the McNeil Company for failure to state a cause of action.

Count III in Negligence Was Properly Dismissed.
Appellants claim that the district court erred when it dismissed the negligence count, count III, asserted against all appellees. Appellants contend on appeal, as they did in district court, that the law ought to impose on all appellees a duty of care in favor of subsequent owners such as appellants. Appellees claim that the district court was correct when it concluded that, notwithstanding appellants' characterization of count III as a cause of action in "negligence," the duties alleged therein stemmed from the underlying contract between the contractor and the original owners such that count III failed to allege a legal duty owed to subsequent owners and thus failed to state a negligence cause of action. We agree with the district court that the complaint does not state a cause of action in negligence in favor of appellants.
In urging this court to conclude that a cause of action in negligence exists as against each appellee, appellants focus primarily on foreseeability. Appellants argue that the risk of harm to subsequent owners was clearly foreseeable, thus giving rise to a case in negligence. Appellants refer us to cases such as Keyes v. Guy Bailey Homes, Inc., 439 So.2d 670 (Miss. 1983), in which it was held, inter alia, that a builder of a home could be liable in negligence to a second or subsequent purchaser and that it was not necessary that privity exist between the builder and subsequent owner. See, similarly, Terlinde v. Neely, 275 S.C. 395, 271 S.E.2d 768 (1980) (stating that subsequent owners are members of class for whom home was constructed, that they are entitled to duty of care in construction, and that key inquiry is foreseeability).
Appellees direct us to contrary authority such as Foxcroft Townhome Owners v. Hoffman Rosner, 105 Ill.App.3d 951, 957, 435 N.E.2d 210, 215, 61 Ill.Dec. 721, 726 (1982), in which the court rejected a purported "general duty" as nebulous and held that subsequent purchasers could not recover for damages from the builder under a negligence theory. See, similarly, Redarowicz v. Ohlendorf, 92 Ill.2d 171, 441 N.E.2d 324, 65 Ill.Dec. 411 (1982) (stating in action by subsequent owner against builder that economic losses not recoverable under negligence theory). See, also, Cosmopolitan Homes, Inc. v. Weller, 663 P.2d 1041 (Colo.1983) (Rovira, J., dissenting) (in action by subsequent owner against builder, dissent rejecting action based on negligence because no legal duty owed subsequent purchaser).
Whether a legal duty in negligence exists is a question of law. Richards v. Meeske, 268 Neb. 901, 689 N.W.2d 337 (2004). Appellants propose that we establish a legal duty; that is, appellants *618 suggest we declare that a tort duty exists in favor of subsequent owners based upon the builder's contractual undertaking to build a house. The legal duty appellants propose is not an inevitable consequence of the contract between the builder and the original owners. That no such legal duty is inevitable is apparent from a comparison of the concepts of contractual duty and tort duty. The difference between the two has been described by Prosser as follows:
The fundamental difference between tort and contract lies in the nature of the interests protected. Tort actions are created to protect the interest in freedom from various kinds of harm. The duties of conduct which give rise to them are imposed by the law, and are based primarily upon social policy, and not necessarily upon the will or intention of the parties. They may be owed to all those within the range of harm, or to some considerable class of people. Contract actions are created to protect the interest in having promises performed. Contract obligations are imposed because of conduct of the parties manifesting consent, and are owed only to the specific individuals named in the contract.
William L. Prosser, Handbook of the Law of Torts § 92 at 613 (4th ed.1971).
In analyzing appellants' argument, it is important to distinguish between the question of to whom a duty is owed upon which appellants focus and the question of what duty is owed. We have repeatedly said that in negligence cases, the duty is always the same, to conform to the legal standard of reasonable conduct in light of the apparent risk. Cerny v. Cedar Bluffs Jr./Sr. Pub. Sch., 262 Neb. 66, 628 N.W.2d 697 (2001). We have stated:
In determining whether a duty exists, [an appellate] court employs a risk-utility test, considering (1) the magnitude of the risk, (2) the relationship of the parties, (3) the nature of the attendant risk, (4) the opportunity and ability to exercise care, (5) the foreseeability of the harm, and (6) the policy interest in the proposed solution.
Fuhrman v. State, 265 Neb. 176, 183-84, 655 N.W.2d 866, 873 (2003).
Because this case was decided on a motion to dismiss, we refer to the complaint to determine the duties of the parties. We have stated:
In order to decide the form of redress, whether contract or tort, it is necessary to know the source or origin of the duty or the nature of the grievance. Attention must be given to the cause of the complaint; in other words, the character of the action must be determined from what is asserted concerning it in the petition in the cause.
Fuchs v. Parsons Constr. Co., 166 Neb. 188, 192, 88 N.W.2d 648, 651 (1958). With the exception of the duty based on city building codes discussed below, it is clear from the complaint that appellants seek to benefit from and establish a duty based on the original owners' contractual arrangement with the contractor. The duty appellants seek to establish cannot be made without reference to the contract, and such duties do not exist independent of the contract. Although we have found that a negligence cause of action will lie between the original owner and builder flowing from their contract, Mondelli v. Kendel Homes Corp., 262 Neb. 263, 631 N.W.2d 846 (2001), we decline to extend and impose a legal duty on appellees in favor of subsequent homeowners stemming from the contract between the original homeowners and the contractor.
With respect to appellants' allegation that the defects violated Omaha building codes, we agree with appellants *619 that building codes create a legal duty, thus giving rise to a potential negligence claim. See Mondelli, supra (discussing negligence action based on violation of construction building code brought by original owners against city). Assuming for analysis that the failure to construct the house according to code is a breach of a legal duty giving rise to a potential negligence claim, a review of the complaint shows that due to the "accepted work doctrine" discussed below, the claim does not benefit appellants.
We review the complaint to ascertain the facts underlying our analysis, accepting all the allegations in the complaint as true and drawing all reasonable inferences in favor of appellants. The complaint shows that appellants were not the original owners or occupiers of the house. The complaint alleges that the defects existed in January 1997, but that appellants did not purchase the house from the original owners until August 2001. The original owners thus accepted the house. The complaint does not allege that appellants had an inspection performed prior to purchasing the house. The complaint does not allege that appellants protected themselves by express agreement in the deed or contract for sale by taking an assignment of the rights which the original owners may have had. See Lee v. Clark and Associates Real Estate, Inc., 512 So.2d 42 (Ala.1987) (declining to find action based on negligence in favor of subsequent purchasers and suggesting that subsequent purchasers can protect themselves by express agreement in deed or contract for sale).
Appellees refer us to and appellants concede that Nebraska applies the "accepted work doctrine" in construction cases. See, Dvorak v. Bunge Corp., 256 Neb. 341, 590 N.W.2d 682 (1999); Parker v. Lancaster Cty. Sch. Dist. No. 001, 254 Neb. 754, 579 N.W.2d 526 (1998). We stated in Parker:
The general rule is that a construction contractor is not liable for injuries or damage to a third person with whom he is not in contractual relation resulting from the negligent performance of his duty under his contract with the contractee where the injury or damage is sustained after the work is completed and accepted by the owner. Delicious Foods Co. v. Millard Warehouse, 244 Neb. 449, 507 N.W.2d 631 (1993); Erickson v. Monarch Indus., 216 Neb. 875, 347 N.W.2d 99 (1984); Stover v. Ed Miller & Sons, Inc., 194 Neb. 422, 231 N.W.2d 700 (1975).
254 Neb. at 757, 579 N.W.2d at 528.
We have also stated: "This court has recognized an exception to the accepted work doctrine in situations where the parties dealt with inherently dangerous elements or the defect at issue was latent and could not have been discovered by the owners or employer." Id. The roofing defects and drainage defects alleged in the complaint are not inherently dangerous. Compare Dvorak, supra (stating that installation of high voltage wiring through conduit and connection of such wiring were inherently dangerous). Furthermore, although the complaint states that the defects were "not reasonably discoverable" by appellants, this allegation does not satisfy the exception to the accepted work doctrine that the defect "could not have been discovered." See Parker, 254 Neb. at 757, 579 N.W.2d at 528. To the contrary, the complaint alleges, inter alia, that the roofing defects were noted in December 2002 when appellants engaged a home inspector to inspect for insurance purposes. Even drawing all reasonable inferences in favor of appellants, it cannot be said that the defects could not have been discovered when the house was accepted *620 by the original owners, and, therefore, appellants cannot benefit from the exceptions to the accepted work doctrine.
To summarize, count III fails to state a cause of action in negligence. There are no allegations which would impose a legal duty on any appellee in favor of appellants, and to the extent a legal duty based on building code violations is alleged, the accepted work doctrine precludes the cause of action based in negligence. Count III in negligence was properly dismissed.

CONCLUSION
With the exception of the dismissal of count I, implied duty to perform in a work-manlike manner alleged against the McNeil Company, the district court did not err in granting the appellees' motions to dismiss. Accordingly, we affirm in part, and in part reverse and remand for further proceedings.
AFFIRMED IN PART, AND IN PART REVERSED AND REMANDED FOR FURTHER PROCEEDINGS.
STEPHAN, J., not participating.
