Struct instance can be object?

Hello
I know instance of class can be object.
How about struct?
Instance of struct can be object?

Answered by OOPer in 632522022

Is there a specific condition that a instance of struct can be called object?

'object' has various meanings. For example, Dictionary of macOS Catalina shows 4 entries for 'object' noun.
The 4th says:

a data construct that provides a description of something that may be used by a computer (such as a processor, a peripheral, a document, or a data set) and defines its status, its method of operation, and how it interacts with other objects.

I think struct matches this definition.

In a context of Swift documentations including header docs of Swift Standard Library, object is often used asan instance of class, for example AnyObject is a type for an instance of any classes. But, not clearly defined what object means in Swift.

There's a note in the Swift book:

Structures and Classes
...
NOTE
An instance of a class is traditionally known as an object. However, Swift structures and classes are much closer in functionality than in other languages, and much of this chapter describes functionality that applies to instances of either a class or a structure type. Because of this, the more general term instance is used.

You may want to use the term object in this traditional meaning, but you should better avoid it unless you can give it a clear definition of your own.
It depends on how you define object.
How do you want to define object?
I didn't specify what the object is yet.
Is there a specific condition that a instance of struct can be called object?
Accepted Answer

Is there a specific condition that a instance of struct can be called object?

'object' has various meanings. For example, Dictionary of macOS Catalina shows 4 entries for 'object' noun.
The 4th says:

a data construct that provides a description of something that may be used by a computer (such as a processor, a peripheral, a document, or a data set) and defines its status, its method of operation, and how it interacts with other objects.

I think struct matches this definition.

In a context of Swift documentations including header docs of Swift Standard Library, object is often used asan instance of class, for example AnyObject is a type for an instance of any classes. But, not clearly defined what object means in Swift.

There's a note in the Swift book:

Structures and Classes
...
NOTE
An instance of a class is traditionally known as an object. However, Swift structures and classes are much closer in functionality than in other languages, and much of this chapter describes functionality that applies to instances of either a class or a structure type. Because of this, the more general term instance is used.

You may want to use the term object in this traditional meaning, but you should better avoid it unless you can give it a clear definition of your own.
Struct instance can be object?
 
 
Q