A
A
Alexander2018-05-29 02:59:54
Python
Alexander, 2018-05-29 02:59:54

What would such C++ code look like?

class Hello:
    def message(self):
        return "Hello user!"

hello = Hello()
print(hello.message())

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikita Shoshin, 2018-05-29
@sanya84

#include <iostream>
#include <string>

class Hello {
public:
  std::string message() {
    return "Hello, user!";
  }
};


int main()
{
  Hello hello;
  std::cout << hello.message();
  return 0;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question