From c777bad38a385bb0ced25c4a65e8130ba85f86c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20M=C3=BCller?= Date: Wed, 25 Dec 2024 21:27:27 +0100 Subject: [PATCH] Add const for Vertex id and getter --- include/aoc/Vertex.hpp | 4 ++-- src/Vertex.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/aoc/Vertex.hpp b/include/aoc/Vertex.hpp index 35f1b20..f696a03 100644 --- a/include/aoc/Vertex.hpp +++ b/include/aoc/Vertex.hpp @@ -23,10 +23,10 @@ class Vertex { public: Vertex(const std::string id); - std::string getId() const; + const std::string getId() const; const std::vector>& getNeighbors() const; void addNeighbor(const std::shared_ptr& neighbor); private: - std::string id_; + const std::string id_; std::vector> neighbors_; }; diff --git a/src/Vertex.cpp b/src/Vertex.cpp index c6f31b7..5b52df0 100644 --- a/src/Vertex.cpp +++ b/src/Vertex.cpp @@ -22,7 +22,7 @@ Vertex::Vertex(const std::string id) { } -std::string Vertex::getId() const +const std::string Vertex::getId() const { return id_; }