Create a sample using compostion in cpp