Can an element in an array be an object?

Updated on technology 2024-02-09
5 answers
  1. Anonymous users2024-02-05

    Yes, this is equivalent to creating an array of objects, and each element of the array is an object, so the methods of that object can also be used by subscripting. However, if you put objects in array a[10], you need to make sure that the type of array a[10] is the same as the type of the 10 objects you put in. Such as:

    seta[10], a[0]=set1;

  2. Anonymous users2024-02-04

    An array is a collection of objects, and it's okay if you think of a collection as something else.

    Arrays are objects, and primitive types such as int float char are not.

    Here's how it goes: The base type is just a value and doesn't have any behavior.

    Object types have their own behavior.

    Memory allocation: The base type is allocated within the stack.

    Objects are allocated within the heap.

    Object references are stored in the stack.

    References and values: The basic type is a value type, which represents only one value, and is stored in two parts in the stack, the reference type is stored in the stack, the object reference is stored in the stack, and the object is stored in the heap.

  3. Anonymous users2024-02-03

    (1) Abstraction.

    Abstraction refers to emphasizing the essence and intrinsic properties of entities. In system development, abstraction refers to the meaning and behavior of an object before deciding how to implement it. Using abstraction is a great way to avoid thinking about details too early.

    Classes abstract the data (i.e., state) and behavior of an object.

    2) Encapsulation (information hiding).

    Encapsulation is the basis for ensuring excellent modularity of software components.

    Object-oriented classes are well-encapsulated modules that are explicitly separated from their description (user-visible external interfaces) from their implementation (user-invisible internal implementations), and their internal implementations provide protection by their specifically defined scopes.

    An object is the most basic unit of encapsulation. Encapsulation prevents the variable effects of program interdependencies. Object-oriented encapsulation is clearer and more powerful than traditional language encapsulation.

    3) Shareability.

    Object-oriented technologies facilitate sharing at different levels:

    Sharing in the same class.

    Objects in the same class have the same data structure. These objects share structural and behavioral characteristics.

    Share within the same app.

    In the class hierarchy of the same application, there is inheritance of data structures and behaviors among similar subclasses where there is an inheritance relationship, so that similar subclasses share a common structure and behavior. The use of inheritance for sharing is one of the main advantages of object orientation.

    Share across apps.

    Object-orientation not only allows information to be shared within the same application, but also prepares the conditions for reusable design for future goals. Through the mechanism and structure of the class library, information sharing in different applications is realized.

    4).Emphasis is placed on object structure rather than program structure.

  4. Anonymous users2024-02-02

    A function in a computer language for a particular program.

    An object is a thing, an entity, a noun, something that can be obtained, anything that can be imagined to have its own identity. An object is an instantiation of a class. Some objects are alive, some are not.

    Inclusion diagram of client object objects.

    Like this car, this person, this house, this table, this plant, this check, this raincoat. In a nutshell: everything is an object.

    Object-oriented (OO) is the focus of the current computer world, and it is the mainstream of software development methods in the 90s. The concept and application of object-orientation has expanded beyond programming and software development to a wide range. Such as database systems, interactive interfaces, application structures, application platforms, distributed systems, network management structures, CAD technology, artificial intelligence and other fields.

    In an ASP dynamic web page, an object is an abstract concept that is the target to be manipulated. For example, in real life, the computer is an object of our search for information, it has the appearance, operating system, ** and so on, which is called the attribute in the concept of the object, and the use of this computer to play games, watch movies, find information and other purposes, this corresponds to the method in the object, in addition, the motherboard, CPU, graphics card, keyboard and other components, we can call the collection of objects.

    In an ASP dynamic web page, the characteristics of objects boil down to three things: properties, methods, and collections.

  5. Anonymous users2024-02-01

    (1) Class. An abstraction of an object with the same or similar properties is a class. Thus, the abstraction of an object is a class, and the concretization of a class is an object, and it can also be said that an instance of a class is an object.

    A class has properties, which are an abstraction of the state of an object, and describe the properties of the class with a data structure.

    A class has an operation, which is an abstraction of an object's behavior, described by the name of the operation and the method by which that operation is implemented.

    2) The structure of the class.

    There are several classes in the objective world, and there is a certain structural relationship between these classes. There are usually two main structural relationships, namely, general-specific structural relationships, and whole-part structural relationships.

    General-specific structures are called categorical structures, which can also be said to be "or" relations, or "is a" relations.

    The whole-part structure is called the assembled structure, and the relationship between them is an "and" relationship, or a "has a" relationship.

    3) Objects. An object is anything that people want to study, from the simplest integer to a complex airplane, and it can represent not only concrete things, but also abstract rules, plans, or events.

    4) The state and behavior of the object.

    Objects have states, and an object describes its state with data values.

    Objects also have operations, which are used to change the state of an object, and objects and their operations are the behavior of objects.

    Objects combine data and operations, encapsulating data and operations in an object continuum.

    5) Messages and methods.

    The structure through which objects communicate with each other is called a message. In the operation of an object, when a message is sent to an object, the message contains information about the receiving object to perform a certain action. At a minimum, the name of the object to which the message is sent and the name of the message sent to the object (i.e., the name of the object and the name of the method) must be included in sending a message.

    Parameters are usually also described, either as variable names known to objects that know the message, or as global variable names known to all objects.

Related questions
5 answers2024-02-09

Arrays are not allowed to add values to them, you can put them in a list. >>>More

8 answers2024-02-09

2D array address - > row address - > column address (variable address) - > variable value, or excerpt a description for you. >>>More

14 answers2024-02-09

The big pumpkin doesn't really need to be added. This skill is relatively inferior to the black hole and the sky thunder, and the little pumpkin also has to be increased to 10, with this sp it is better to add more flame black ball Lei Xuan and the like. >>>More

10 answers2024-02-09

It's wonderful

Homeless, incredible, incredible >>>More