background preloader

Fundamentals

Facebook Twitter

Object-oriented programming. Overview[edit] Rather than structure programs as code and data, an object-oriented system integrates the two using the concept of an "object".

Object-oriented programming

An object has state (data) and behavior (code). Object (computer science) Rather than structure programs as code and data an object-oriented system integrates the two using the concept of an "object".

Object (computer science)

An object has state (data) and behavior (code). Objects correspond to things found in the real world. So for example, a graphics program will have objects such as circle, square, menu. An online shopping system will have objects such as shopping cart, customer, product,. The shopping system will support behaviors such as place order, make payment, and offer discount. Class (computer programming) In some languages, classes are only a compile-time feature (new classes cannot be declared at runtime), while in other languages classes are first-class citizens, and are generally themselves objects (typically of type Class or similar).

Class (computer programming)

In these languages, a class that creates classes is called a metaclass. Types generally represent nouns, such as a person, place or thing, or something nominalized, and a class represents an implementation of these. For example, a Banana type would represent the properties and functionality of bananas in general, the ABCBanana and XYZBanana classes would represent ways of producing bananas (say, banana suppliers or data structures and functions to represent and draw bananas in a video game).