 Hello guys crypto grounds here welcome back to another C sharp crash course video this is episode seven today we're gonna be talking about classes setters basically last episode we made a method now we're making setters where we can actually change the variable outside of the main class so here we have our setup pretty much the same thing as last time except I added a constructor method where we can pre define it as two so we can do here is we can create an object I mean obviously this is static so this can be accessed anywhere so what we can do is if we do console a dot number now it's not going to work because this is private but if we make a getter it will return to just like we did last time except instead of zero it's two all right so I'm not going to touch anything there all right because we don't have a getter but we don't really really don't need to do this just to kind of explain that last time but we need it what if we want to change this outside of our class so two things the difference between doing this statically is that we only want to change it like this if we want to change this entire class this default or just its variables in general so if it's does a blueprint and this is being used throughout the entire namespace as like for example let's say our namespace is school or our main class is school let's say we have a ton of these if we change this number it'll change for all of them because it's static right however it's not static then we're only going to change it for our predefined object so first I'm going to show you how to do what it looks like for static so here we're going to make our method we're just going to call it public void it's void because we're not returning anything public void set number now this is difference because it's going to be we're going to be inputting a number so we're just going to do int x now this can be named anything so whatever you'd prefer so in here this is pretty easy because basically we just do whatever you want to set number equals x now in here if you have another variable you can always set more than one variable let's say you want to set numbers and you have number one number two you can do int x and x or int y and you can change number one equals x number two equals y if that makes sense it doesn't just have to be one number all right so there's our setter very easy instead of returning we're setting something in here now what we do here since this is static also before I forget this is a static class after all so we have to do public static void okay make sure you put the static or else it won't work so another thing I forgot to mention this is static but what about our constructor is that static too it actually is this on purpose just to see if you're following along and just so I don't forget to explain that but this is supposed to be a public static a okay to make sure it's static all right sorry my phone keeps running out of storage I need to clean it up but anyways I kind of didn't realize that happened until I started writing stuff so I'll kind of explain what I did so basically what I did here is that so last clip we did static right yeah so what I did here is that we created our a object right here and we decided to add int x over here because let's say we want to pre-define what number is when we created that object right so now in here we do temp dot set number and then we put our integer in and it will change number in object a to four all right so now in this situation in this setup right here we don't have to have static right because we're creating objects let's say we want to also do a dot set number and let's say we want to set this to five all right so this will change the blueprint version of number to five right this is different from here this is an object this is the blueprint basically this is like a default for this so if we didn't have this at all and we didn't have this constructor so let's clear this let's clear that too let's make this two let's get rid of that so let's say let's say it looks like this right so if we create this right now number will be two okay however if we change the static version to five and then we do temp equals new a the number is going to be five instead of two because we basically just overrided this with a new version of the static method or the static class of a all right hopefully that makes sense so basically um so we want that to be two right so before this is two number is two but in here number is five because we are replacing this is this is replacing two okay all right hopefully i didn't miss anything or didn't get anything wrong i am positive this is how everything works um because i personally don't handle this on a daily basis so if i'm wrong let me down below and i can correct this video but otherwise if i did and you like this video make sure you leave a like every single like means a lot to me and don't forget to subscribe and turn on notifications anyways thank you guys for watching have a good one peace