LECTURE 29Object-Oriented ProgrammingObject Oriented ProgrammingClasses & ObjectsE7, Fall 2008, M. Frenklach1Procedural Programming•The design focuses on steps that must be executed to achieve a desired state.•One typically represents data as individual variables or fields of a structure and implement operations as functions that take the variables as arguments.•Programs usually call a sequence of functions each one of which is passed data functions, each one of which is passed data, and then returns modified data. Each function performs an operation or perhaps many operations on the data.2Object-Oriented Designdefines objects, that:•organize (systematize) data•define methods (functions)•link data and methods•protect data•hide implementation (complexity)3Object-Oriented Design•A class describes a set of objects with common characteristics.•Objects are specific instances of a class. The values contained in an object’s properties are what make an object different from other objects of the same classclass.•The functions defined by the class (called th d ) ht ilt bjt methods) are what implement object behaviors that are common to all objects of a class (you can add two doubles regardless of their values).4
has intentionally blurred sections.
Sign up to view the full version.