Microsoft Store
 

Class (computer science)


 

In object-oriented programming, a class consists of a collection of types of encapsulated instance variables and types of methods, possibly with implementation of those types together with a constructor function that can be used to create objects of the class. A class is a cohesive package that consists of a particular kind of compile-time metadata. A Class describes the rules by which objects behave; these objects are referred to as "instances" of that class. A class specifies the structure of data which each instance contains as well as the methods (functions) which manipulate the data of the object; such methods are sometimes described as "behavior". A method is a function with a special property that it has access to data stored in an object. A class is the most specific type of an object in relation to a specific layer. A class may also have a representation (metaobject) at run-time, which provides run-time support for manipulating the class-related metadata.

Related Topics:
Object-oriented programming - Encapsulated - Instance variable - Method - Cohesive - Metadata - Objects - Instance - Methods - Functions - Behavior - Type - Layer - Metaobject

~ ~ ~ ~ ~ ~ ~ ~ ~ ~

Instances of a class will have certain aspects (aka: features, attributes or properties) in common. A class Person for example would describe the properties common to all instances of the Person class. One of the benefits of programming with classes is that all instances of a particular class will follow the defined behaviour of the class they instantiate. Each person is generally alike; but varies in such properties as "height" and "weight". The class would list types of such instance variables; and also define, via methods, the actions which humans can perform: "run", "jump", "sleep", "throw object", etc.

Related Topics:
Person - Action

~ ~ ~ ~ ~ ~ ~ ~ ~ ~