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 is oledb in c#?
What is asp net c# corner?
Explain the different types of delegates used in c#.
what is a structure in c#
How long can a string be c#?
What is the difference between new and override in c#?
What is a console file?
What do you mean by winforms in c#?
What does xpath return?
How do you create partial methods?
Explain async and await?
How can you reference current thread of the method ?
What are cshtml files?
Can you mark static constructor with access modifiers?
Which programming language is best for desktop applications?