Object-oriented programming

Object-oriented programming is a paradigm which focuses on modelling software in the form of objects which are conceptually similar to real world objects. For example a dog, a house, a bicycle or a car could be considered objects.

Objects

Real-world objects share two characteristics: They all have state and behavior. Dogs have state (name, color, breed, hungry) and behavior (barking, fetching, wagging tail). Bicycles also have state (current gear, current pedal cadence, current speed) and behavior (changing gear, changing pedal cadence, applying brakes). In programming the state of an object is expressed through fields and the behaviour is expressed through methods.

Classes

A class is the blueprint from which individual objects are created. For example, a bicycle is an instance of the class of objects known as bicycles.

Source:

results matching ""

    No results matching ""