Similarly, classes define objects by telling other code what the object contains and what it can do . Classes are essential in object-oriented programming (as well as ASP.NET). You define a class to wrap up some common code and properties, just like combining clock parts to build a clock.