From 29ffd7c7b4e8ca490d7805a2849a29eb71858bfd Mon Sep 17 00:00:00 2001 From: Raymond Degbe Date: Thu, 24 Mar 2022 11:19:15 +0000 Subject: [PATCH] Made virtual int _id() function return a const Since the function does no mutation to the _id variable it returns from private, it is a good practice in c++ to make it return const --- src/main/cpp/algorithms/datastructures/stack/Stack.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/cpp/algorithms/datastructures/stack/Stack.h b/src/main/cpp/algorithms/datastructures/stack/Stack.h index 2758e83..a1ba8f9 100644 --- a/src/main/cpp/algorithms/datastructures/stack/Stack.h +++ b/src/main/cpp/algorithms/datastructures/stack/Stack.h @@ -42,7 +42,7 @@ class Stack virtual ~Stack() {} // return the ID the stack implementation - virtual int id() { return id_; } + virtual int id() const { return id_; } // return the number of elements in the stack virtual int size() = 0;