What is the need of a destructor?
No Answer is Posted For this Question
Be the First to Post Answer
Should I learn c or c++ or c#?
What is decltype c++?
List out some of the object-oriented methodologies?
What is slicing?
How is static data member similar to a global variable?
How do you initialize a class member, class x { const int i; };
Find out the bug in this code,because of that this code will not compile....... #include <iostream> #include <new> #include <cstring> using namespace std; class balance { double cur_bal; char name[80]; public: balance(double n, char *s) { cur_bal = n; strcpy(name, s); } ~balance() { cout << "Destructing "; cout << name << "\n"; } void set(double n, char *s) { cur_bal = n; strcpy(name, s); } void get_bal(double &n, char *s) { n = cur_bal; strcpy(s, name); } }; int main() { balance *p; char s[80]; double n; int i; try { p = new balance [3]; // allocate entire array } catch (bad_alloc xa) { cout << "Allocation Failure\n"; return 1; }
Can I learn c++ as my first language?
What is a memory leak c++?
Which one is a preferred language C or C++? Why?
Where and why do I have to put the "template" and "typename" keywords?
When is a template a better solution than a base class?