Object-oriented programming: Difference between revisions

Content deleted Content added
Add internal link
Tags: Visual edit Mobile edit Mobile web edit Advanced mobile edit
Add internal link
Tags: Visual edit Mobile edit Mobile web edit Advanced mobile edit
Line 128:
{{Main|Object (computer science)}}
 
An object is a [[data structure]] or [[abstract data type]] containing [[Field (computer science)|fields]] (state [[variable (computer science)|variable]]s containing data) and [[Method (computer programming)|method]]s ([[subroutine]]s or procedures defining the object's behavior in code). Fields may also be known as members, attributes, or properties. Objects are typically stored as contiguous regions of [[Memory address|memory]]. Objects are accessed somewhat like variables with complex internal structures, and in many languages are effectively [[Pointer (computer programming)|pointers]], serving as actual references to a single instance of said object in memory within a [[Heap (data structure)|heap]] or [[Stack (abstract data type)|stack]].
 
Objects sometimes correspond to things found in the real world.<ref>{{cite book|last=Booch|first=Grady|title=Software Engineering with Ada|year=1986|publisher=Addison Wesley|isbn=978-0-8053-0608-8|page=220|url=https://en.wikiquote.org/wiki/Grady_Booch|quote=Perhaps the greatest strength of an object-oriented approach to development is that it offers a mechanism that captures a model of the real world.}}</ref> For example, a graphics program may have objects such as "circle", "square", and "menu". An online shopping system might have objects such as "shopping cart", "customer", and "product". Sometimes objects represent more abstract entities, like an object that represents an open file, or an object that provides the service of translating measurements from U.S. customary to metric.