Hello, in this video we are going to look at data hiding, which is a pretty cool thing. And it's very similar to what we've just done. Yeah. So what I'm gonna do is simplify most of this. So let me get rid of most of this we don't really need this anymore. Neverland the child class that we inherited, don't care about the destructor anymore, get rid of overloaded my third tactic and even going to get rid of that.
So really, this is all that we need so far. Why so? Okay, so if in here, I create a new vehicle, record in car one equals vehicle. passing a parameter file, I do print one dot speed run this Okay, was the Euro funds maybe like that? Then I wired it, sorry. So yeah, if I were to run this Wi Fi printer, so what we can do is hide our attribute.
So it's not directly visible to any, you know, outside. So to do that, you just put double underscore to make sure you change it here, because otherwise, this self.is creating a variable. And I think see this is moaning now we're trying to run it. It's a no attribute, because you know, this is double underscore now, we might put two underscores here, run that it's still gonna moan because he said it had it because it's hidden. But now it's a warning, saying if I'm trying to access a protected member, if you've done public protected private variable in other languages and you'll feel right at home here it's not public accessible by inside and outside protected only accessible by itself and children and private only accessible by itself. In terms of acronyms, so this isn't working if you wanted to counter if you wanted to really you could do this so could you call one the instance object dot underscore the totally the name of your class which is vehicle dot underscore name, eu class dot not on this one school speed and this one this so we can access it this way.
So it's a instance of vehicle has no fondness to cod access to a protected member. Generally speaking, you shouldn't doing this. You should use getters and setters too. Essentially set your speed and to actually, you know, get variables. So honestly, that's the best route to go that but just want to show data hiding and how to use it. Thanks for watching and I look forward to seeing you in the next video.