• (2 Pages)
  • +
  • 1
  • 2

The Listener Pattern The Listener Pattern AKA The Observer Pattern Rate Topic: -----

#16 richyankee  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 30-September 16

Posted 30 September 2016 - 08:39 AM

The compiler allows this because it's not wrong, it is a virtual function. However the virtual keyword in the derived class is not required, since it's information the compiler already knows.

However, I think it's good to have in the derived class because it gives more information about the function without having to dive deeper into the code to other people (or you yourself a few months/years later).

So to summarize: it's not necessary but can make the code a bit clearer. (Of course in a small example like this this is less relevant, but it's still good practice I think.)
[/quote]


Thanks - I that's clear.
Rich
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2