Static int a; // Class Variables
Student abc = new Student(); // Reference Variables
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Feb 5, 2015, 12:18 PM
If Student is a class, then it's a reference type or object variable.
If Student is a struct, then it's a value type or value variable.
The term 'object' is not normally used with value types in .NET.
However, the term 'instance' can be applied to either classes or structs so 'abc' could be termed an instance variable in either case.
Brijesh GajjarPosted Feb 5, 2015, 11:50 AM
Student abc = new Student(); is a object variable or reference variables ?
VulpesPosted Feb 5, 2015, 11:48 AM
In contrast, instance variables apply to a particular instance and so each instance has its own copy which persists until the instance is garbage collected.
From outside the class and provided they are accessible, class variables are always accessed by prefixing them with the class name whereas instance variables are accessed through a reference to the instance in question.