What happens if the base class method is private, and you try to override it in a derived class?

  • Compilation error
  • The base class method is called
  • The derived class method is overridden
  • The derived class method is private
If the base class method is private, it cannot be overridden in the derived class. Attempting to do so will result in a compilation error, as private methods are not accessible outside the class.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *