 Hello guys, CryptoGround here. Welcome back to another C-Shop Crash Course video. This is episode 6 and today We're gonna be doing the two-string method now This will be very easy Video to do and to follow along it should be quick. Anyways, if you enjoyed this video and you learned something new make sure you smash that like Button subscribe to my channel if you're new and turn on those notifications So you get notified for future videos and live streams comment all your feedbacks Gestions and compliments all that good stuff below and if you want to support me the patreon link is in the description below Anyways, let's hop into it. So we have our the same script from last time. I haven't changed anything Okay, so what we're gonna do is we're gonna do the two-string so this will be used to print out Whatever you want to when we call a certain method, which is to string, okay? So what we're gonna do in our district class is we're gonna create a method called a string method called to string Okay, now you'll see that we have this yellow line here, right? The key word new is required to string because it hides methods string system object to string So what this means is that we are not allowed to use this because we are not doing something and that is called Overriding, okay, so we do this by adding the override term. Okay. Oh I don't know what it did there But you type override. Okay. Oh I did the guy flipped it. I think it's override string Yep, there we go. So now we have overrided the default one. Okay, so let's get rid of this real quick Okay, so by default if we delete this Here, let's just delete these right here Let's try doing district dot to string. Okay, so there each class has a default to string to it or each object Okay, now let's do district dot to string. Let's see what happens here Okay, so by default the to string basically just prints out the type Okay, which is it is a type of namespace blue print district. Okay, so basically it kind of just Says what it is. Right? Okay, so we need to override this So let's go back to what we had the I think I already have it copied it, right? No, okay, so override string To string. Okay, so override is to override a current or any a pre-existing method that exists in that class Override can be used for so many things such as overriding operators And stuff like that. It's really useful So in here and we have this red squiggly line because we haven't returned anything yet So by default we can return just a regular string, right? But I want to print out our data in a certain format. Okay So what we can do here is that We can just put district and then we'll print out its name. So we just do name Has school count Schools, okay, so now what we're doing here is that we are printing out this one line thing that says the school district And we'll print out its name and we're using string interpolation in here. I'm like we did last video I use the plus to empty string and I'll explain more in depth later on like I said in the previous video Has school count schools. So basically, how do we format this? How does this work? So when we add a dollar sign to the the beginning of a string we're allowed to use Curly stuff like curly braces inside and we put variables in here. Okay. It's a very cool very helpful And when we have string or numbers and we want to show certain Amount of decimals instead of doing dot two string like f2 for example, right? Actually here, let's do it right here school counts dots to string f2 Normally we would have to do this right but in a string interpolation like this in this format We can do it colon f2 instead So it makes things a lot cleaner, but again, I'll get to this in the future I'm just talking a little bit more than I should. Okay, so let's run it. Let's see what happens So now it says the school district California school district has 25 schools Cool. What if we do the second district right here? What will it say now? Okay, so now it says the school district Washington State School District has zero schools Okay, now we can do so much more with this obviously then just have a simple line If we have like an analytics class we can display the analytics for example Like all the variables in a different format We can do tons of stuff with this and do a bunch of fun things like this Now this is some boring example But I feel like doing a district school district is an amazing example for showing you the structural part of the code And how it's organized it can how it can be organized efficiently. Okay Anyways, if you learned something new make sure you smash that like button Subscribe to my channel if you're new and turn on those notifications for future videos and live streams comment all your feedback Suggestions and complements below and if you want to support me to check out the patreon link It's in the description below. Anyways, I'll catch you guys in the next one. Peace