Objects: Difference between revisions
Mr. MacKenty (talk | contribs) |
Mr. MacKenty (talk | contribs) |
||
(5 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
[[file:arrows.png|right|frame|Programming basics<ref>http://www.flaticon.com/</ref>]] | [[file:arrows.png|right|frame|Programming basics<ref>http://www.flaticon.com/</ref>]] | ||
<noglossary> | |||
In the class-based object-oriented programming paradigm, "object" refers to a particular instance of a class where the object can be a combination of variables, functions, and data structures.<ref>https://en.wikipedia.org/wiki/Object_(computer_science)</ref> | In the class-based object-oriented programming paradigm, "object" refers to a particular instance of a class where the object can be a combination of variables, functions, and data structures.<ref>https://en.wikipedia.org/wiki/Object_(computer_science)</ref> | ||
Line 6: | Line 7: | ||
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). Identifying the state and behavior for real-world objects is a great way to begin thinking in terms of object-oriented programming.<ref>https://docs.oracle.com/javase/tutorial/java/concepts/object.html</ref> | 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). Identifying the state and behavior for real-world objects is a great way to begin thinking in terms of object-oriented programming.<ref>https://docs.oracle.com/javase/tutorial/java/concepts/object.html</ref> | ||
</noglossary> | |||
== Example == | |||
In the image below, we see an example of the relationship between an object and class. An object is derived from a class. An object is created from a class. You can think of a class as a blueprint, and an object created from that blueprint. The image below is used with grateful permission from Javin Paul<ref>http://www.java67.com/2016/09/oops-concept-tutorial-in-java-object-oriented-programming.html</ref> | |||
<br /> | |||
[[File:Object and class.jpg]] | [[File:Object and class.jpg]] | ||
== Standards == | == Standards == |
Latest revision as of 07:05, 1 October 2018
![](/images/f/f0/Arrows.png)
In the class-based object-oriented programming paradigm, "object" refers to a particular instance of a class where the object can be a combination of variables, functions, and data structures.[2]
Objects are key to understanding object-oriented technology. Look around right now and you'll find many examples of real-world objects: your dog, your desk, your television set, your bicycle.
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). Identifying the state and behavior for real-world objects is a great way to begin thinking in terms of object-oriented programming.[3]
Example[edit]
In the image below, we see an example of the relationship between an object and class. An object is derived from a class. An object is created from a class. You can think of a class as a blueprint, and an object created from that blueprint. The image below is used with grateful permission from Javin Paul[4]
Standards[edit]
- Define the terms: variable, constant, operator, object.