c 2b 2b class member initialization

Solutions on MaxInterview for c 2b 2b class member initialization by the best coders in the world

showing results for - "c 2b 2b class member initialization"
Hannah
10 Jan 2017
1class Test  {
2private:
3  std::string data;
4public:
5  test(std::string data) : data(data) {}
6  std::string getData() {
7    return data;
8  }
9};
10
11int main() {
12  Test test("This is just some random Text");
13  std::cout << test.getData() << std::endl;
14  return 0;
15}