Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
jonjo9428yI never use private because I am always developing in C but with static you can have a function pointer to it thus giving you external access. Is it the same?
-
@jonjo
That's better. With a private static function, you are removing access to the function from any external or internal Object -
civel1138yYeah, to call it from a public static function is the main reason.
Sometimes you want to encapsulate/organize functionality but not actually expose it on the interface of the object. -
tahnik387588yNothing wrong with having a private static function. Maybe you want to keep some logics separate from the public interface
-
magnusi5828y@jonjo I am afraid not. The new languages dont let people do the wonderful things C can. I am pretty sure everyone would be in bliss if they could throw type safety out of the window on demand or intertwine a switch and a while loop or just do everything the guys over at IOCCC do 😀
-
oscylo9538yUseful if you want to let everybody know that this method does not change object's state and its usage is restricted to this class.
Why would anyone declare a private static function ???? Like WTF????
undefined
#codewise #teamwork #reuseablecode