0

I'm getting the compile error as mentioned in the heading for the code below.

#include <iostream>
#include <string>
using namespace std;
class Test
{
    std::string name;
    public:
    Test() {name = "rr";}
    Test(std::string input) {name = input;}

    std::string PrintName() { return name; }
};

int main()
{
    const char* myname = "rr";
    Test t1(std::string(myname));
    cout << t1.PrintName() << endl;
}

Please help

StoryTeller - Unslander Monica
  • 165,132
  • 21
  • 377
  • 458

0 Answers0