Content deleted Content added
m →top: Fixed typo Tags: canned edit summary Mobile edit Mobile app edit Android app edit |
mNo edit summary Tags: Reverted Visual edit |
||
Line 5:
{{Programming paradigms}}
'''Object-oriented programming''' ('''OOP''') is a [[programming paradigm]] based on the concept of "[[Object (computer science)|objects]]", which can contain [[data]] and [[Computer program|code]], as opposed to functions and logic. The data is in the form of [[Field (computer science)|fields]] (often known as [[Attribute (computing)|attributes]] or ''properties''), and the code is in the form of procedures (often known as ''[[Method (computer science)|methods]]'').
A common feature of objects is that procedures (or methods) are attached to them and can access and modify the object's data fields. In this brand of OOP, there is usually a special name such as [[this (computer programming)|{{code|this|C++}}]] or {{code|self|swift}} used to refer to the current object. In OOP, computer programs are designed by making them out of objects that interact with one another.<ref>{{Cite journal
Line 142:
Each object is said to be an [[instance (computer science)|instance]] of a particular class (for example, an object with its name field set to "Mary" might be an instance of class Employee). Procedures in object-oriented programming are known as [[Method (computer science)|methods]]; variables are also known as [[Field (computer science)|fields]], members, attributes, or properties. This leads to the following terms:
* [[Class variable]]s – belong to the ''class as a whole''; there is only one copy of each one and cannot be used outside the class.
* [[Instance variable]]s or attributes – data that belongs to individual ''objects''; every object has its own copy of each one
* [[Member variable]]s – refers to both the class and instance variables that are defined by a particular class
|