base: Make Named::name() virtual
Allow inherited classes to modify the defaul behavior of name(). This can be useful, for example, when the class names relies on sub-modules' names. Change-Id: I6a4bc0cd13ca05e75557ed90b12a6bd6708925ec Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/43245 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com> Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
This commit is contained in:
committed by
Daniel Carvalho
parent
5f0e38bab0
commit
ad5ae10c8e
@@ -41,7 +41,7 @@ class Named
|
||||
Named(const std::string &name_) : _name(name_) { }
|
||||
virtual ~Named() = default;
|
||||
|
||||
const std::string &name() const { return _name; }
|
||||
virtual const std::string &name() const { return _name; }
|
||||
};
|
||||
|
||||
#endif // __BASE_NAMED_HH__
|
||||
|
||||
Reference in New Issue
Block a user