 Trying to get the new cat acclimated to everything and of course he's following me around everywhere You've got I don't know where the other one went The funny thing is it's the biggest like giant cat It's hiding underneath the bush because he's um Yep, and now that the little kittens here. He's all pissed off and like leave me the fuck alone There's the other one He's not bad. He um He's warming up quite a bit more. He hisses if the if this little guy gets too close, but He largely doesn't give a shit and you can see the big ones over there now stalking him out Yeah, looking around right now, but He goes right back to stalking him So then what's the next thing to cover? In this case, I think a close analog to the type system would actually be one of the best things to get into and What I Mean by that would be the way in which things are made accessible So visibility or accessibility modifiers This is a short one, which I think will be good for offsetting how long the other two have been But generally speaking, I don't think and it gets this right at all even for what it is intended for I don't think it gets this right the thing it is with C sharp Which does a More java inspired than c++ inspired but in either case you would have gotten what you needed You have very fine grained accessibility controls You can set very specific things as public specific things as private and so on This winds up being incredibly useful because You really don't want to leak all little details out into the world You want implementation details hidden because they're Implementation details right It doesn't always work that way unfortunately with at a You're not really given too much of a choice if it's Declared in the normal spot. It is public in every sense of the word You need that you need public exposed You need public accessibility Your next option is to put things in the private part of the package which is Not private in the sense that the majority of people mean by private When something is in the private part of a package Packages that are not part of that package's name space So say you have package a which has a private member b and then you have package c C would not be able to see b however If you have another package D which is a subchild of a so that is d's fully qualified name is a dot d It would be able to see b so private in Atta means something much more closer to protected just It's protected at the or friend if you're used to that terminology It means something much closer to to those but essentially that the level of the the Inheritance part is done at the package level not the type level, but it it's otherwise essentially protected or friend That's weird now I do see Uses for that and there are situations where I Really would have appreciated that some Rare but existing cases in the dot net world where Well, that's not a dot net thing But some existing cases in c sharp or visual basic or f sharp where I actually really could have benefited from that that I Wish it had an accessibility modifier for that, but let me be clear I think that should be an additional accessibility modifier on top of the four They already support or five if you look at protected and internal together as its own unique mode So then that would bring it up to six but I do Well, there'd probably be permutations of this one. So then it'd go up even more but the the idea is that It is potentially useful But it should not be One of your only options and in Atta. It's one of your only options It is useful in pointing out that this Um accessibility modifier is Potentially dangerous because of how it works and that there is code exploits That you can write for at a library is or and whatnot that take advantage of this fact Um That you can hook into essentially a different library entirely and start running code from inside of it That's not supposed to be publicly accessible because of how that works Remember there are no restrictions on making a child namespace Oh Boy the little cat's going up to the big fat one who hates other cats. So I need to to address this There is another accessibility modifier, however, and it's not really all that obvious, but But There is an actual private Thing in ita there. There is a way to get your Any definitions actually private and It's super weird that So it's how ita names things that there's tons of things that it names that I don't agree with how it names them um Clearly this is one of them, but if you declare something inside of the package body Then it is actually private Even child packages will not be able to see it Now If you think about this this essentially means that ita has three modifiers in total public this Sort of protected internal thing going on except it's not internal to the assembly. It's internal to the namespace And then things outside of from another assembly, but still part of that namespace can still read it It's called private, but it's obviously not And then actual private Hi brucey Bruce is the big well not big but fluffy one Bruce really Hi fluffy boy So that doesn't leave us with a whole lot of options and with the way it's declared and the way that Ita goes through and parses everything and does all the references and resolutions This means that unfortunately You don't have a lot of fine grain control and a It's It's tricky. I Don't care for it You want information hiding to be easy to do because you don't want information leaking out of your types You don't want Internal implementation details being leaked out because you simply can't encapsulate them well enough and unfortunately Ita lends itself very well to that It's not what you want to lend yourself to C sharp On the other hand and visual basic and f sharp all do the same thing Um I've sharp's got a few very minor differences, but it's not worth talking about in this so Modifiers are put on specific fields specific property a specific methods And one That allows them to be fine grained So rather than applying to the entire type and everything within it You can have a type which is public Expose a few public things to go along with it and then have all the rest of the details Say protected or private Whatever's relevant Or sometimes even internal sometimes that is a thing you want to do um Not often, but it happens But you can set the specific things to that Which means the only time you're leaking any details that shouldn't be is because You fucked up not because the language forced you to now Those modifiers aside from public you have private which actually means private that one's useful Um, it's nice that it's clear about what it actually is You have protected which means that anything associated with that Anything inside of that type rather and remember we are working with class A class based approach to object oriented programming. So protected method is one that Type that inherits from this type would be able to see but isn't publicly visible outside of that. So This is potentially useful for implementation details Especially if You're setting up say like a framework where a type that derives from this type Would need access to those implementation details, but that you don't want to pollute a public namespace by showing them um It's a very useful concept Uh, you also have internal which is a similar concept But the idea is that it's internal to the assembly And outside of the assembly you cannot see it, but inside of the assembly it is essentially public This does leak encapsulated details a little bit, but there are justifications for doing it and it's typically in situations where um Say you've got a type that's going to be modified throughout the assembly where it was created but is going to be As far as appearances goes read only after it leaves that assembly This is useful for performance reasons You want a nice read only object so that people can't tamper it and you get all the benefits of read only kinds of you know immutable programming But you get the performance benefits of actually being able to mutate it While you're still fully creating the object Okay, that's a that's a good use for it And um, so it's not always obvious where internal becomes useful, but that that's that's a great example of where it's actually useful Well, you can combine those last two protected and internal together into its own sort of modifier and essentially what it does is it combines them as a more like an More like an or operation rather than an either or or an and So oh Jesus What you wind up getting is that protected internal thing Is accessible from anywhere And anything that inherits from that type, but also anywhere inside the assembly as well So that's um useful at times for when you need to do those internal modifications, but also need to expose it to Um Anything inheriting from it like a with a with a framework kind of thing This is often used in the same kind of way that internal is used Make sure he's not in here with you Oh, he is. Henry get the hell out of here You're done fucked up All right, I wound up having to put him back uh inside because There's way too much fighting going on between them Yeah, they're still not doing a great job of getting uh Tolerant of each other. Of course, that's what happens when you've got three male cats and Two of them have been together since birth despite being different letters well, not that's actually a little complicated, but um You know, they've gotten used to each other they consider themselves Family or whatever the hell they view themselves as But the other one's an outsider and being a male outsider cat, even if it's young They don't want nothing to do with it. So Gotta break through the whole territorial thing and that takes time and a lot of close attention to what's going on between them stopping fights Oh, that shit So we're essentially wrapping this up now because that covers all of the accessibility modifiers for c-sharp as well VB largely having them as Different name protected in c-sharps called friend and visual basic much like It would be in c++ I'm not sure what java calls them. I don't remember that detail anymore um And I really haven't seen anything for accessibility modifiers in other languages that I've particularly liked uh seems like Anything that really does it well does sort of the same thing that C-sharp or vb has got going on where they're attached to the specific thing so that you have Fine grain control over it so that you're not leaking out other details and There are multiple options. Now like I said, I would like to see a situation where um Ida's ability to Expose it to any child Is still there But that's a very niche modifier and I I There's not too many cases where that is useful. Uh, like I said, I just run into a Very small amount where it has been potentially useful, but it is exploitable. So um It's one of those proceed with cautions here be dragons kind of thing Um Yeah, that's that's it for this one. I gotta let this charge up and then I'll uh be putting out another video until then Have a good one guys