Cpp templates, set getters and setters as virtual to allow overriding

Change-Id: I374a0ff710f7a777a8cdafd7f89c6a0fa856ab1e