Write a program having class STRING, With data member which can store character array (Dynamically you can store). It should facility to initialize by parameterize constructor and concatenate STRING objects.
Ex: STRING obj1(“OOP”), obj2 (“IN KIIT”);
Obj1 = obj1 + obj2;
Then obj1 should have “ OOP IN KIIT” string in it.
#include <iostream>
using namespace std;
class STRING{
private:
string a;
public:
STRING(string x){
a=x;
}
};
int main()
{
STRING obj1("OOP"), obj2 ("IN KIIT");
obj1 = obj1 + obj2;
return 0;
}
Comments
Leave a comment