Output ?
#include<iostream>
#include<string.h>
using namespace std;
class String
{
char *str;
public:
String(const char *s);
void change(int index, char c) { str[index] = c; }
char *get() { return str; }
};
String::String(const char *s)
{
int l = strlen(s);
str = new char[l+1];
strcpy(str, s);
}
int main()
{
String s1("geeksQuiz");
String s2 = s1;
s1.change(0, 'G');
cout << s1.get() << " ";
cout << s2.get();
} Which of the followings is/are automatically added to every class, if we do not write our own.
Which of the following gets called when an object is being created ?
Destructor has a same name as the constructor and it is preceded by ?
Like constructors, can there be more than one destructors in a class ?
Destructors __________ for automatic objects if the program terminates with a call to function exit or function abort
Which contructor function is designed to copy object of same class type ?
If the copy constructor receives its arguments by value, the copy constructor would
which of this can not be declared as virtual
We must use initializer list in a constructor when
Which of the following implicitly creates a default constructor when the programmer does not explicitly define at least one constructor for a class ?