Answer Posted / ctharam
Objects can be created by using the new keyword followed by the name of the class that the object will be based on, like this:-
1) Customer object1 = new Customer();
NOTE:- When an instance of a class is created, a reference to the object is passed back to the programmer. In the previous example, object1 is a reference to an object that is based on Customer.
2) Customer object3 = new Customer();
Customer object4 = object3;
NOTE:- This code creates two object references that both refer to the same object. Therefore, any changes to the object made through object3 will be reflected in subsequent uses of object4. Because objects that are based on classes are referred to by reference, classes are known as reference types.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What does immutable mean in c#?
Does c# have primitives?
How the versioning applies to Assemblies or can you explain version numbers?
What is the difference between “finalize” and “finally” methods in c#?
In a C# class we have a SortedList member m_addinProjects
we want to provide an iterator to allow the consumer of
this class access to the items in the collection. Please
provide an iterator method for the AnalyzeAddinsDLL class
below and an example of how it would be used.
namespace AnalyzeAddinsDLL
{
public class AllAddInProjects
{
private SortedList
Explain about Destructor method?
What is the use of iqueryable in c#?
What is the purpose of a console table?
What is a multi line comment?
Why hashtable is thread safe in c#?
Explain the types of errors in c#?
What is the difference between static class and sealed class in c#?
What floating point types is supported in C#?
How do I type a whitespace character?
What is option parameter in C#?