1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
HACTEHA [7]
3 years ago
7

There exists a data type Date with member function Increment that increments the current Date object by one. The ++ operator is

being overloaded to postincrement an object of type Date. Select the correct implementation:
1.Date Date::operator++( int ){Date temp = *this;Increment();return *temp;}2.Date Date::operator++( int ){Increment();Date temp = *this;return temp;}3.Date Date::operator++( int ){Date temp = *this;return this;temp.Increment();}4.Date Date::operator++( int ){Date temp = *this;Increment();return temp;}
Computers and Technology
1 answer:
nalin [4]3 years ago
3 0

Answer:

Date Date::operator++( int )

{

Date temp = *this;

Increment();

return temp;

}

Explanation:

Of options 1 through 4, only option 4 correctly implement the post increment of the ++ operator.

Interpreting each line of option for and comparing it to other options

Line 1: Date Date::operator++( int )

This declares the data type and its ++ operator

This is same for all options

Line 2: The Date type needs to be declared

In option 4, it was declared correctly as Date temp = *this;  using a pointer variable *this.

Here, option 2 is removed from the list of possible options.

Comparing other options

Line 3: The member increment option needs to be declared after the declaration of the date type variable.

This is correctly declared as Increment();  in option 4

Here, option 3 is removed from the list of possible options.

Comparing other options

Line 4: The value declared variable temp needs to be returned the way it was declared (without pointer indicator)

Hence, option 4 is best appropriate

You might be interested in
Click to visit W3Schools.com
KonstantinChe [14]

Is this self advertising because its not a question so i have no answer for you and if i missed something on the website that was a question let me know

3 0
3 years ago
Read 2 more answers
Advantages of a personal area network
Ratling [72]
The main advantage is the security, the pan is a personal network of one or two person so there is no risk of any leak of data, best way to share resources each other via bluetooth

4 0
3 years ago
Marco had a database that showed the first, second, and third favorite ice cream flavors for each person in his school. He used
Maksim231197 [3]

Answer:

B

turned data into information

7 0
2 years ago
Read 2 more answers
Non related to school but im interested,<br><br> Who here actually watches dream smp be honest
Kamila [148]
I did- but I don’t anymore
3 0
2 years ago
Read 2 more answers
I need help..
labwork [276]

Answer:

which app are u using u should use Android studio or if u are using mac book use xcode

5 0
3 years ago
Other questions:
  • 20 Points!! Please hurry!!
    9·1 answer
  • What mass of nh3 can be made from 35g of n2?
    14·1 answer
  • A server provides the necessary IP configuration to your network host so the host can communicate on the network. If this servic
    7·1 answer
  • Given an array as follows
    11·1 answer
  • adding ______around calculations indicates which calculations should be performed first before following the typical order of op
    6·1 answer
  • Does the security burden fall primarily on the user? On
    10·1 answer
  • 1. Create an optimized function "print s(n,s)" that prints the given argument s (representing a string) k times. k represents th
    7·1 answer
  • Write the name of main ore of silver.Write any two application of sliver​
    14·1 answer
  • If you double the force of and object what happens to the acceleration
    10·1 answer
  • your manager asked you to set up a secure network connection at a remote site to move over some back ups. what protocol what do
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!