Usually with object-oriented venues, at least in my experience, defect density falls under the "quality estimation" measure and then related to reliability. So, in this sense, reliability is measured as number of defects. The estimated number of defects is usually normalized by a size measure (to get around strict lines-of-code) to obtain a defect density estimate. This is then measured in relation to the actual number of defects. They basically just use the standard equation:
[defect density = (number of defects in product) / (total size of product)]
So you can use function points or you can use the more popular (these days) use case points or you can use one of the class-based size measures. One of the problems, of course, is that its a complexity metric to the extent described here. As such, object-oriented design, with the basis of complexity, does not just rely on the flow between statements within a procedural routine but rather on the nature of the method calls, something that traditional complexity measures have not really taken into account, until recently, and so defect density became a very misleading measure in some instances.