Consider the following code: class node { public: typedef int value_type; node( const value_type& init_data =...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Consider the following code: class node { public: typedef int value_type; node( const value_type& init_data = value_type(), node* init_link - NULL>< data = init_data; link= init link; } node* get_link() const (return link;} value_type get_data() const (return data; } private: } node link; value_type data; }; int main() { node* ptr1= new node(); const node* cons_ptr1= new node (40, ptr1); // LINE1 delete cons_ptr1; // LINE2 cons_ptr1= new node(); // LINE3 cons_ptr1->get_link(); // LINE4 return 0; The code works OLINE 4 cause error OLINE 1 cause error OLINE 2 cause error OLINE 3 cause error his Consider the following code: class node { public: typedef int value_type; node( const value_type& init_data = value_type(), node* init_link - NULL>< data = init_data; link= init link; } node* get_link() const (return link;} value_type get_data() const (return data; } private: } node link; value_type data; }; int main() ( node* ptr1= new node(); const node* cons_ptr1= new node (40, ptr1); // LINE1 delete cons_ptr1; // LINE2 cons_ptr1= new node(); // LINE3 cons_ptr1->get_link(); // LINE4 return 0; The code works OLINE 4 cause error OLINE 1 cause error OLINE 2 cause error OLINE 3 cause error his Consider the following code: class node { public: typedef int value_type; node( const value_type& init_data = value_type(), node* init_link - NULL>< data = init_data; link= init link; } node* get_link() const (return link;} value_type get_data() const (return data; } private: } node link; value_type data; }; int main() { node* ptr1= new node(); const node* cons_ptr1= new node (40, ptr1); // LINE1 delete cons_ptr1; // LINE2 cons_ptr1= new node(); // LINE3 cons_ptr1->get_link(); // LINE4 return 0; The code works OLINE 4 cause error OLINE 1 cause error OLINE 2 cause error OLINE 3 cause error his Consider the following code: class node { public: typedef int value_type; node( const value_type& init_data = value_type(), node* init_link - NULL>< data = init_data; link= init link; } node* get_link() const (return link;} value_type get_data() const (return data; } private: } node link; value_type data; }; int main() ( node* ptr1= new node(); const node* cons_ptr1= new node (40, ptr1); // LINE1 delete cons_ptr1; // LINE2 cons_ptr1= new node(); // LINE3 cons_ptr1->get_link(); // LINE4 return 0; The code works OLINE 4 cause error OLINE 1 cause error OLINE 2 cause error OLINE 3 cause error his
Expert Answer:
Answer rating: 100% (QA)
The code has several issues 1 LINE1 const node consptr1 new node 40 ... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
This assignment reviews object-oriented programming concepts such as classes, methods, constructors, accessor methods, and access modifiers. It makes use of an array of objects as a class data...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
Sugar (C12H22O11) is a molecular compound that stays together inwater, while NaCl and MgSO4?7H2O are ionic compounds that dissociate into cations andanions as illustrated in the NaCl example below:...
-
If you can choose to list your firm anywhere in the world, which country would you prefer? Why? Does where you list enhance your corporate performance?
-
Do people walk faster in the airport when they are departing (getting on a plane) or when they are arriving (getting off a plane)? Researcher Seth B. Young measured the walking speed of travelers in...
-
As sales manager for a global technology company, you have been tasked with opening up a new market in Asia. One of your responsibilities is to create a sales force consisting of 20 new salespeople....
-
1. Under what conditions would it be practical for a company to send recruiters to college campuses to interview prospective employees, and when would it be impractical? What kinds of companies would...
-
Windsor Corporation wants to raise $1,210,000 via a rights offering. The company currently has 220,000 shares of common stock outstanding that sells for $32 per share. The issue will allow current...
-
A grocery store manager must decide how to best present a limited supply of milk and cookies to its customers. Milk can be sold by itself for a profit of $1.50 per gallon. Cookies can likewise be...
-
How can financial advisors help their clients think biblically about taxes?
-
The gas pedal of an automobile is commonly referred to as the accelerator. Which of the following might also be called an accelerator: (a) the brakes, (b) the steering wheel, (c) the gear shift, or...
-
Examination of the data set reveals that it is symmetric with a mean of 98.2 and a median of 98.2. Decide whether the statement makes sense (or is clearly true) or does not make sense (or is clearly...
-
An object traveling at a constant velocity vo experiences a constant acceleration in the same direction for a period of time t. Then an acceleration of equal magnitude is experienced in the opposite...
-
A car is traveling at a constant speed of 60 mi/h on a circular track. Is the car accelerating? Explain.
-
For a constant linear acceleration, the position-versus time graph would be (a) a horizontal line, (b) a vertical line, (c) a non-horizontal and non-vertical straight line, (d) a curve.
-
Employment at will affects for the employer and employee depending on which party exhibits this right first. The healthcare sector could be the most affected by this law by the fact that it is a...
-
Explain the Hawthorne effect.
-
Heres a class declaration: class Move { private: double x; double y; public: Move(double a = 0, double b = 0); // sets x, y to a, b showmove() const; // shows current x, y values Move add(const Move...
-
Provide method definitions for the class described in Chapter Review Question 5 and write a short program that illustrates all the features. Data From Question 5 Define a class to represent a bank...
-
Declare an array of five ints and initialize it to the first five odd positive integers.
-
What other solutions could you see be effective at improving employee motivation and reducing the turnover rate? Why do you believe these solutions would be useful?
-
Should the whole team have decided on the team members schedule accommodations collectively? Why or why not?
-
In what ways do you believe providing special work arrangements or accommodations for employees impacts employee motivation? How does it help? How does it hurt?
Study smarter with the SolutionInn App