OOP with TypeScript: Encapsulation Part 3

TypeScript
Transcript

English (Auto-generated)

they get their functions. So how we can do that. We are just going to go there and uh we are going to create another method like get height. H I D H T H E I G H T. Okay. Get height and uh what more space? Space is not necessary actually. But you know, so here we're not gonna set any value. So we're not expecting us to or the to send any value in in in in in form of the parameters using the objects. Uh you know, the objects parameters. So we're just here and we're gonna go inside and we're talking recherche. I want to return something. They start hide now. I mean this looks quite simple and this is quite simple. Um Instead of calling the whole whole object um which you can call anyway, you're just going to go down console the log. Sorry. Okay. And we're just gonna, you know, we're just gonna call something like, you know, first of all, what? T1. name. Mhm. Mhm. It is potential. I mean it's a potential hurts credential um person. Okay. I mean, this guy has the potential, his let's call, it's because you know, we are not defining if it's, you know, male or the female. But we're gonna Absolutely. Anyway, it's uh age is Talking about the P1.age and has T. One that chill color. Okay, mm hmm. Here the height of even that full name is now uh you know the thing which which is the most important part all the height as you know, Cuban dot height because it's private. So what we're gonna do, we're gonna use this get height I mean yeah function. We just cannot call the seat height function because set height function, you know, asks for some data. We're not going to provide the data right? Calling the data, we already provided the data data by, you know, by this way. We already did that. Now we need to call the data so we need to so just go there and uh P1. hyped and just this way I mean simple and understandable. Now what you need to do, you need to, you know, you need to go there and you need to call declare and you need to first PSC because you're going to convert it into the javascript and now you're gonna run the node and the script says and then you, you got it John Mark is a potential person, it's ages 40 and has black hair colour. The height of John Mark is 1 60 mm Okay. 1 68 cm. I mean that's okay. But this was this one was the last thing. So that is how you can simply, you know, call the getter function the second function. This is how you call it. But why we even did it, you know, what is the benefit? The benefit? Uh I'm gonna in the next video for sure in the next cast for sure. So you need to practice practice together function and then we will move along.
107 Views 0 Likes 0 Comments

Let's talk about encapsulation.

Comment
Leave a comment (supports markdown format)