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
xenn [34]
3 years ago
12

The destructor automatically executes when the class object goes out of ____.

Computers and Technology
1 answer:
Tema [17]3 years ago
4 0

Answer:

scope    

Explanation:

Destructor is a member function and it call automatically when the class object goes out of scope.

Out of scope means, the program exit, function end etc.

Destructor name must be same as class name and it has no return type.

syntax:

~class_name() { };

For example:

class xyz{

  xyz(){

        print(constructor);

   }

~xyz(){

        print(destructor);

   }

}

int main(){

    xyz num;

   

}//end program

when the object is create the constructor will called and when the program end destructor will call automatically.

You might be interested in
Two cars A and B leave an intersection at the same time. Car A travels west at an average speed of x miles per hour and car B tr
drek231 [11]

Answer:

Here is the C++ program:

#include <iostream>  // to use input output functions

#include <cmath>  // to use math functions like sqrt()

#include <iomanip>  //to use setprecision method

using namespace std;   //to access objects like cin cout

int main ()  {  //start of main function

  double speedA;  //double type variable to store average speed of car A

  double speedB;  //double type variable to store average speed of car B

  int hour;  //int type variable to hold hour part of elapsed time

  int minutes;  //int type variable to hold minutes part of elapsed time

  double shortDistance;  // double type variable to store the result of shortest distance between car A and B

  double distanceA;  //stores the distance of carA

  double distanceB;  //stores the distance of carB

  double mins,hours;   //used to convert the elapsed time

cout << "Enter average speed of car A: " << endl;  //prompt user to enter the average speed of car A

cin >> speedA;   //reads the input value of average speed of car A from user

cout << "Enter average speed of car B: " << endl ;  //prompt user to enter the average speed of car B

cin >> speedB;   //reads the input value of average speed of car A from user

cout << "Enter elapsed time (in hours and minutes, separated by a space): " << endl;  //prompts user to enter elapsed time

cin>> hour >> minutes;    //reads elapsed time in hours and minutes

  mins = hour * 60;  //computes the minutes using value of hour

  hours = (minutes+mins)/60;     //computes hours using minutes and mins

distanceA = speedA * (hours);  // computes distance of car A

distanceB = speedB * (hours);   //computes distance of car B

   shortDistance =sqrt((distanceA * distanceA) + (distanceB * distanceB));   //computes shortest distance using formula √[(distanceA)² + (distanceB)²)]

cout << "The (shortest) distance between the cars is: "<<fixed<<setprecision(2)<<shortDistance;

//display the resultant value of shortDistance up to 2 decimal places

Explanation:

I will explain the program with an examples:

Let us suppose that the average speeds of cars are:

speedA = 70

speedB = 55

Elapsed time in hours and minutes:

hour = 2

minutes = 30

After taking these input values the program control moves to the statement:

mins = hour * 60;  

This becomes

mins = 2 * 60

mins = 120

Next

hours = (minutes+mins)/60;

hours = (30 + 120) / 60

         = 150/60

hours = 2.5

Now the next two statements compute distance of the cars:

distanceA = speedA * (hours);  

this becomes

distanceA = 70 * (2.5)

distanceA = 175

distanceB = speedB * (hours);

distanceB = 55 * (2.5)

distanceB = 137.5

Next the shortest distance between car A and car B is computed:

shortDistance = sqrt((distanceA * distanceA) + (distanceB * distanceB));

shortDistance = sqrt((175 * 175) + (137.5 * 137.5))

                        = sqrt(30625 + 18906.25)

                        = sqrt(49531.25)

                        =  222.556173

shortDistance =  222.56

 

Hence the output is:

The (shortest) distance between the cars is: 222.56        

3 0
3 years ago
To add a slide using the default layout, what should you do before clicking the New Slide button?
SIZIF [17.4K]

You have to add it and then there should be a layout button and you have to press that button

4 0
3 years ago
I need help quick Which of the following principles is not part of the constitution?
laila [671]

Answer:

Confederalism is not in the constitution it was adopted later.

Explanation:

5 0
3 years ago
How frequently should computers containing ehr information be backed up?
geniusboy [140]
Explain what is meant by a limited data set and how this HIPAA rule may affect medical assistants
7 0
3 years ago
_ includes websites that encourage interaction and connection among people, businesses, and organizations. A. News sites B. Sear
Dovator [93]
> News sites give information about news or what is trending around the area or world (CNN, Fox, MSNBC, etc) 

> Search engines is what allows you to look up websites (Google, Bing, Yahoo, etc) 

> Social media AKA Social Networking sites is interaction social sites where you connect with various people from around the world. (Facebook, Twitter, Google+, etc)

>Apps is short for applications which is an application that has a specific function (Games, Music, Social networking) 

So based on this, you answer is C. Social Media
6 0
3 years ago
Read 2 more answers
Other questions:
  • Jerry is making an address book using a digital database. He has a list of his immediate family and friends but wants to add a f
    9·2 answers
  • You decide to buy some stocks for a certain price and then sell them at another price. Write a program that determines whether o
    9·1 answer
  • When planning a presentation, there are several factors you need to consider. Which of the following is one factor you should co
    8·1 answer
  • Which country began expanding its borders with exploration in the late 16th<br>century?​
    15·1 answer
  • You are part of the team to implement new software at XYZ Inc. The employees at XYZ Inc. trust the results of the old software p
    15·1 answer
  • In a _____ network, each device on the network is attached to a central server. If the server fails, then the other devices will
    8·1 answer
  • Why hackers hack?? in other people?​
    8·2 answers
  • Write a function named “createPurchaseOrder” that accepts the quantity (integer), the cost per item(double), and the description
    13·1 answer
  • What is the first phase of the project process?
    14·2 answers
  • Which of the following recommendations should you follow when placing access points to provide wireless access for users within
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!