Posted on May 14, 2014
1.) What is an Object?
Object is an instance of a class; it contains real values instead of variables. For example, let’s create an instance of class Employee called “John”.
Employee John= new Employee ();
Now we can access all the methods in the class “Employee” via object “John” as shown below.
2.) What are the Access Modifiers in C#?
Different Access Modifier are – Public, Private, Protected, Internal, Protected Internal
3.) Define Static Members in C#?
private static double MinSalary = 30000;
To access a private or public attributes or methods in a class, at first an object of the class should be created. Then using that instance of class, attributes or methods can be accessed. To access a static variable, we don’t want to create an instance of the class having the static variable. We can directly refer that static variable as shown below.
double var = Employee.MinSalary ;
Posted By-: Vissicomp Technology Pvt. Ltd.
Website -: http://www.vissicomp.com
This entry was posted in DotNet and tagged attribute and methods, attributes name, attributes value, class and interfaces, create an instance, defined as Internal, dot net, instance of a class, Internal, interview questions of dot net, keyword, Private, Protected, Protected Internal, Public, real values, restricted to classes, TYBCA, TYBSc(CS), TYBSc(IT).