Program of Dynamic Constructor

/*Program of Dynamic Constructor*/

#include
#include
#include
class abc
{
char *string;
int length;
public:
abc()
{
length=0;
string=new char[length+1];
strcpy(string,” “);
}
abc(char *s)
{
length=strlen(s);
string=new char[length+1];
strcpy(string,s);
}
void display()
{
cout<OUTPUT:
DON DON2







Leave a Reply

Your email address will not be published. Required fields are marked *