0

I have three public method in base class. When i inherit the base class to derived class, the three public method should not get accessed.

How to achieve this?

Can someone hep me out to find answer for this?

user3815683
  • 21
  • 1
  • 1
  • 3
  • attempting to do something like this goes very much against Liskov's substitution principle http://stackoverflow.com/questions/56860/what-is-the-liskov-substitution-principle Additionally, this probably depends on what language you're talking about, you did not specify. For something like C#, this is not possible, because it is not something that should be done. – Kritner May 02 '16 at 10:44
  • When overriding a method you can only make it more public, not more private. – Adnan May 02 '16 at 10:47
  • You cannot hide public methods from your base classes. You can just override the public methods. – Ajir May 02 '16 at 10:59

1 Answers1

0

According to basic OOP.

If a class have some methods and you inherit that base class to derived class. You can do override these methods BUT. You can only maintain it's accessibility or you can improve it.