Go back to Richel Bilderbeek's homepage.
Go back to Richel Bilderbeek's C++ page.
Const methods do not change the (non-mutable) member variables.
Follow a standard method design.
struct HelloWorld
{
void SayHelloWorld() const { std::cout << "Hello World" << std::endl; }
};
{
HelloWorld h;
h.SayHelloWorld();
}
The class 'HelloWorld' has a single const method called 'SayHelloWorld'. It is called in main, producing the same output as a Hello World program.
Go back to Richel Bilderbeek's C++ page.
Go back to Richel Bilderbeek's homepage.