0
we could have print the value of age variable directly in the class, then why use this.age ?
2 odpowiedzi
+ 5
There are several usages of this keyword in C#.
To qualify members hidden by similar name
To have an object pass itself as a parameter to other methods
To have an object return itself from a method
To declare indexers
To declare extension methods
To pass parameters between constructors
To internally reassign value type (struct) value.
To invoke an extension method on the current instance
To cast itself to another type
To chain constructors defined in the same class
+ 1
a class used to create fwo objects...
so if you print them from the class it self it's good but most of time you don't need to print them imadiatly ...
and you need them also for checking if age is 18+ or anything else