blob: b6cdd874e39ec2ad00dc3ab276ca9ca068011f8e [file] [log] [blame]
Brian Silverman4e662aa2022-05-11 23:10:19 -07001// Copyright 2020 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
4// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
5// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
6// option. This file may not be copied, modified, or distributed
7// except according to those terms.
8
9#pragma once
10
11#include <cstdint>
12#include <sstream>
13#include <stdint.h>
14#include <string>
15
16class Goat {
17public:
18 Goat() : horns(0) {}
19 void add_a_horn();
20 std::string describe() const;
21private:
22 uint32_t horns;
23};
24
25inline uint32_t DoMath(uint32_t a) {
26 return a * 3;
27}
28
29inline void Goat::add_a_horn() { horns++; }
30inline std::string Goat::describe() const {
31 std::ostringstream oss;
32 std::string plural = horns == 1 ? "" : "s";
33 oss << "This goat has " << horns << " horn" << plural << ".";
34 return oss.str();
35}