create a class named programming.while creating an object of the class if nothing is passed to it then the message i love programming languages should be printed if some string is passed to it then in place of programming language the name of that string
#include <iostream>
#include <string>
using namespace std;
class Programming
{
private:
string s;
public:
Programming()
{
cout << "I love programming languages";
}
Programming(string ss)
{
s = ss;
cout << "I love " << s;
}
};
int main( )
{
Programming* pr = new Programming();
cout << endl;
Programming* pr1 = new Programming("C++");
return 0;
}
Comments
Leave a comment