Monster shadow

VIDEO

Static in 60 seconds #Shorts

Description:
This was tough to do in 60 seconds. But I think it gives a good primer :)
ADD A COMMENT

Michu
keep going! very cool
Plínio José
For this example specific, you could create a video talking about Extension Methods, which could be a good use too if used wisely.
Tom Duff
oh wow the static int thing blew my mind! That's so useful
Makra
Your shorts are gonna blow up soon!
OfficialGOD⚡- Pokémon Unite
Lol coming from js this is funny
slamsal
Js doesn't even have true classes😭
Paulo Rodriguez
hhhhmmm nice
SEE ALL COMMENTS


Transcript:

using a regular non-static method is done by creating an object and then
calling the method on the object like so we are specifically telling this
instance of the pokemon class to attack for a static method we declare it on the
class and then use the static decorator now we can use this method anywhere
within our code base by writing the class name and then the method directly
no object is required you may have seen static methods around
a few examples are the math class and the console class
static can also be used for properties in our pokemon class we have the name
and power properties these properties are not static so they belong to the
individual objects i created using this class now let's add a static property to
the pokemon class called activate pokemon count every time we create a new
pokemon we add one to the active pokemon count integer this property does not
belong to any object specifically but is shared and can be accessed anywhere in
our code