d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Question About Subclassing
Add Reply New Topic New Poll
Member
Posts: 31,401
Joined: Mar 25 2009
Gold: 134.00
Jun 8 2019 06:47pm
Say i have some field variables in super class with a few methods
how do i make those methods private from all other classes/packages, but useable/visible in subclass of super class only?

This post was edited by ferf on Jun 8 2019 06:48pm
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Jun 9 2019 09:15am
in c#, this is the "protected" access modifier. c# has a separate one called "protected internal" which lets you use it in subclasses but also in the assembly.

java also has a "protected" access modifier, but it's equivalent to c#'s "protected internal"
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll