Skip to content

Instantly share code, notes, and snippets.

@jpyatachkov
Created October 4, 2017 20:43

Revisions

  1. jpyatachkov created this gist Oct 4, 2017.
    28 changes: 28 additions & 0 deletions getters.cpp
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    class Gettable
    {
    public:
    explicit Gettable(int attribute);

    Gettable &setAttribute(int attribute);
    int attribute() const;

    private:
    int _attribute;
    };

    Gettable::Gettable(int attribute):
    _attribute(attribute)
    {

    }

    Gettable &Gettable::setAttribute(int attribute)
    {
    _attribute = attribute;
    return *this;
    }

    int Gettable::attribute() const
    {
    return _attribute;
    }