Question: Consider the following code: class node { public: typedef int value_type; node( const value_type& init_data = value_type(), node* init_link - NULL> < data =
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
Step by Step Solution
There are 3 Steps involved in it
The code has several issues 1 LINE1 const node consptr1 new node 40 ... View full answer
Get step-by-step solutions from verified subject matter experts
