[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/vixcpp/note/main/examples/cpp_classes.vixnote [Back]  [Original]

# Classes in C++

A class groups data and behavior together.


```cpp
#include 
#include 

class Greeter
{
public:
  explicit Greeter(std::string name)
      : name_(std::move(name))
  {
  }

  void say_hello() const
  {
    std::cout 
Classes are useful when data and behavior should live together.

Web Proxy Viewer  |  New URL  |  Original Page