0

we could have print the value of age variable directly in the class, then why use this.age ?

4th May 2016, 6:57 AM
Umesh Kuniyal
Umesh Kuniyal - avatar
2 Réponses
+ 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
20th May 2016, 1:40 PM
James Flanders
+ 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
12th Sep 2016, 6:58 AM
avy7352
avy7352 - avatar