Send
Close Add comments:
(status displays here)
Got it! This site uses cookies. You consent to this by clicking on "Got it!" or by continuing to use this website.nbsp; Note: This appears on each machine/browser from which this site is accessed.
Classes and objects
1. Classes and objects
2. Classes and objects
An understanding of classes and objects is essential to understanding object-oriented concepts.
3. Objects
An instance is a specific occurrence of a general idea.
4. Classes
An object is an instance of a class.
5. Cars
An
class is a template for how to make instances of objects.
class of cars
a blueprint is used to create an instance of a car (an actual car)
a Mazda Protege is an instance of the class of cars (produced by Mazda)
6. Cookie cutters
A cookie-cutter template is used to create a cookie as an instance of an idea of a cookie.
7. Object properties
An object has specific properties, methods, and reacts to or creates events.
8. Properties
A property is an attribute of the object.
Personal property is something that belongs to a person.
9. Methods
A method is a way of doing something.
Some methods work better than other methods at accomplishing a given task.
A
method is a means to have the object do something (i.e., do an operation).
10. Events
An event is something that happens.
An
event is triggered when something special happens.
11. Mouse events
In most
GUI (
Graphical User Interface) architectures, when the mouse moves on the screen, an event is created whenever it enters or leaves a control object such as a link object, a image object, etc. The object receives the message that the mouse is entering, and may change the appearance property of the mouse cursor. Likewise, when the mouse leaves a control object, the object receives a message and can change the cursor back to what it was.
12. House analogy
A class is like a blueprint of a house that could be built.
A house object is an instance of a house class.
The house object inherits most of the properties of the house class, but the house object can be customized by making modifications to the class.
13. The baby object
A baby class consists of a general idea of a baby.
A baby object is a specific baby, created by two people as an instance of a baby class.
A baby has properties such as height, weight, skin color, eye color, etc.
Baby methods include the touch method, the see method, the hear method, the feed method, etc.
14. Baby events
A baby can create events such as the cry event, the poop event, the hunger event, etc. These events require handling from an outside source.
A baby can react to events from outside sources. Such events include the feel something event, the see something event, the hear something event, the eat something event, etc. (Often, the hunger event triggers the cry event which triggers the eat something event, which triggers the poop event).
15. Desktop
The desktop has properties: screen appearance
Move to an empty of the desktop
Right click
Select "Properties" to see properties of the "Desktop" object.
Select "New" to see some methods of the "Desktop" object.
16. End of page
17. Multiple choice questions for this page
9 questions omitted (login required)
18. Acronyms and/or initialisms for this page
1 acronyms omitted (login required)