Do you really know public, private and protected in Ruby?
21-Mar-2019 2094
Public, private and protected access - all of the programmers are familiar with that concept. Nothing special, we work with them on a daily basis. However, as Ruby programmers, do we really know the details?You can check yourself with these five statements. Try to answer: TRUE or FALSE.Statements:Public methods have no access control - they can be called from the outside of the class definition by the instance of that class or it’s subclasses.Both protected and private methods cannot be called from the outside of the defining class.Protected methods are accessible from the subclass and private methods are not.Private methods of the defining class can be invoked by any instance of that class.Public access is the default one.
Do you really know public, private and protected in Ruby? #ruby #rubydeveloper #rubyonrails #really #public, #private #protected #Ruby? https://rubyonrails.ba/link/do-you-really-know-public-private-and-protected-in-ruby