C Question class questions with C

Updated on technology 2024-08-05
9 answers
  1. Anonymous users2024-02-15

    Question 7: Select A because option AIf you want to use lei duixiang to define an object, you need to explicitly define the parameterless constructor when there is a copy constructor.

    Option b: The custom copy constructor needs to copy all data member values from the reference object.

    The argument to the copy constructor of option C lei can be a const reference to the lei object or not a const reference.

    Option d Copy Constructor can only be called when the object is returned as a parameter of the function and assigned to the same kind of object after the object is created, not arbitrarily.

    So the statement about copying the constructor is correct is a

    Here's an example of a copy constructor.

  2. Anonymous users2024-02-14

    Hello, I'm sorry, I don't learn programming, I can't understand this you sent, I can't answer it for you, I'm really sorry.

  3. Anonymous users2024-02-13

    The C++ program written according to the requirements of the topic is as follows (see figure).

  4. Anonymous users2024-02-12

    Question 8, i - will be executed once, but I don't know if it counts as a loop, I personally think it should be a loop, otherwise the answer loops zero times is not a good example.

  5. Anonymous users2024-02-11

    The constructor initialization list begins with a colon, followed by a comma-separated list of data members, each followed by an initializer in parentheses.

    For example: example::example().

    ival(0),dval(

    ival and dval are the two data members of the class.

    The above example looks the same as the following constructor that doesn't need to initialize the list:

    example::example()

    Indeed, the result of these two constructors is the same. But here's the difference: the constructor above (the one that uses the initialization list) shows the members of the initialization class; The constructor, which does not use the initialization list, assigns values to the members of the class, but does not initialize the display.

    Initialization and assignment don't make much difference to members of built-in types, like any of the constructors above.

    But sometimes you have to use a constructor with an initialized list:

    A member type is a class that doesn't have a default constructor. If no display initializer is provided, the compiler implicitly uses the default constructor for the member type, and if the class does not have a default constructor, the compiler's attempt to use the default constructor will fail.

    const member or reference type member. Because const objects or reference types can only be initialized, they cannot be assigned.

  6. Anonymous users2024-02-10

    The specific idea is as follows:

    Sequence: Keyboard - Host - Monitor.

    Their relationship with the computer class is the HAS-A relationship, that is, the three plus some related functions to form the computer class. For this type, the composition is usually written directly into the class, for example:

    class computer

    int main()

  7. Anonymous users2024-02-09

    If you want to write a computer class, you define a computer class that contains three functions, representing the functions of the keyboard, the monitor, and the host.

    Among them, the keyboard function realizes the function of input - it can get data from the keyboard and return the data; The host function implements the processing of the data - it needs parameters to get the processed data, and then returns the processed data; The display function implements the output of data - it needs parameters to get the data that needs to be output, and it does not need to return a value.

  8. Anonymous users2024-02-08

    Computer class as a base class? The other three parts inherit the computer class. And then communicate through the friend function?

  9. Anonymous users2024-02-07

    You can start by dividing it into three big parts:

    1) Keyboard 2) Display 3) Host then each part is implemented with a class, and then each class is subdivided.

    Keyboard: Receive input that you can use to be as precise as you need for each key;

    Display: the destination of the output stream;

    Host: Processing of data.

Related questions
3 answers2024-08-05

Heada and headb are both singly linked lists with leading nodes. In this algorithm, we delete the common elements from the ith element in the heada linked list, and then insert the single-linked list heada before the jth element of the headb. >>>More

10 answers2024-08-05

First of all, a Class C has 254 addresses but there is always one as a gateway route, so there can be a maximum of 253 hosts. Then these hosts are public IP addresses. It can be done by setting up a LAN and using one IP. >>>More

7 answers2024-08-05

Something like this.

#include >>>More

5 answers2024-08-05

In fact, it is much easier to read by adding parentheses to the first part of your formula! They are the same! >>>More

9 answers2024-08-05

Class C fires are gas fires. Such as fires caused by gas, natural gas, methane, ethane, propane, hydrogen, etc. >>>More