Objects and Classes - Assigning Value - Instance Specification
8 important questions on Objects and Classes - Assigning Value - Instance Specification
Objects are on a lower level of abstraction than ...?
Now, we’ll emphasize the notation, capability, and features of an object/instance specification.
Let us first distinguish between objects, instances, and instances specifications.
What is an "Object" and what is an "Instance" ?
An “instance” is the same thing, with an emphasis on the fact that there is a class or a type (a classifier) involved, i.e., an “instance” of a class
What is the difference between a class and an Instance Specification?
A class designates a set of instances, while an Instance Specification identifies one of a potentially smaller set.
- Higher grades + faster learning
- Never study anything twice
- 100% sure, 100% understanding
What is not optional in an Instance Specification?
If you don’t indicate a class, the instance specification is indicating that the class isn’t important – and an instance of any class will do.
If you don’t indicate the name, then the name of the instance isn’t important. The name compartment can also display any relevant stereotypes.
What are the slots in the name compartment?
The literal value must be compatible with the types of the attributes.
Often the attribute types are repeated after the slot name, as shown below.
title: String = “Tom Sawyer”
An additional .... compartment can be added
There are no ...... Or ..... compartments.
There are no operations or signals compartments.
The elements that would be in these compartments would be captured in the class definition and do not need to be repeated.
Similarly, in the slots compartment, don’t repeat slots unless you really care about their values in this circumstance.
You should distinguish between the ..... name and the ....of any particular attribute.
For example:
we could have changed the class definition to have a name:String attribute and correspondingly change the title slot to be a name slot.
In such a case, the name of the instance would still be “myBook” and the name attribute of the instance would be “Tom Sawyer.”
What is the dashed arrow? ![]()
The question on the page originate from the summary of the following study material:
- A unique study and practice tool
- Never study anything twice again
- Get the grades you hope for
- 100% sure, 100% understanding
