c++ constructor implementation snippet