C#.Net Interview Question and Answers

16. What is the difference between Object and Instance?
  An instance of a user-defined type is called an object. We can instantiate many objects from one class.
An object is an instance of a class.
 
Digvijay Kumar Singh, said Jan 17,2014
Object– Object is Allocated the memoy by using the New Keyword.
Exam – Class a =new Class it is object Insatnce:- Instance taken the reference of object. Exma:- Class b=a.
Your Name Your Email-ID
Your Answer
17. Define destructors?
  A destructor is called for a class object when that object passes out of scope or is explicitly deleted.A destructors as the name implies is used to destroy the objects that have been created by a constructors.Like a constructor , the destructor is a member function whose name is the same as the class name but is precided by a tilde.
 
Your Name Your Email-ID
Your Answer
18. What is the use of enumerated data type?
  An enumerated data type is another user defined type which provides a way for attaching names to numbers thereby increasing comprehensibility of the code. The enum keyword automatically enumerates a list of words by assigning them values 0,1,2, and so on.
 
Your Name Your Email-ID
Your Answer
19. Define Constructors?
  A constructor is a member function with the same name as its class. The constructor is invoked whenever an object of its associated class is created.It is called constructor because it constructs the values of data members of the class.
 
Your Name Your Email-ID
Your Answer
20. What is encapsulation?
  The wrapping up of data and functions into a single unit (called class) is known as encapsulation. Encapsulation containing and hiding information about an object, such as internal data structures and code.
 
Your Name Your Email-ID
Your Answer