#include <iostream>

using Color = int;
struct Shape
{
  double area = 0;
};

class Geometry
{
public:
  // everybody can alter the color of the geometry, so 
  // they get a mutable reference
  Color& color() { return m_color; };

  // not everybody can alter the shape of the Geometry, so
  // they get a constant reference to the shape.
  Shape const& shape() const { return m_shape; };

protected:
  // derived classes can alter the shape, so they get 
  // access to the mutable reference to alter the shape.
  Shape & shape() { return m_shape; };

private:
  Shape m_shape;
  Color m_color;
};


void someFunction(Geometry & g)
{
  std::cout << g.shape().area << std::endl;
}

int main ()
{
  Geometry g1;
  someFunction(g1);
  return 0;
}