Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is the use of New Keyword

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


Please Help Members By Posting Answers For Below Questions

What is oledb in c#?

912


What is asp net c# corner?

1280


Explain the different types of delegates used in c#.

927


what is a structure in c#

1641


How long can a string be c#?

880


What is the difference between new and override in c#?

982


What is a console file?

943


What do you mean by winforms in c#?

944


What does xpath return?

994


How do you create partial methods?

960


Explain async and await?

1829


How can you reference current thread of the method ?

943


What are cshtml files?

870


Can you mark static constructor with access modifiers?

961


Which programming language is best for desktop applications?

920