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

Where static variables are stored?

880


How do you read an Excel sheet in C#?

935


Asha buys 16 Chocolates for rs 12 and 24 chocolates for rs 20, if she sold them 30 chocolates for rs 30 then what is the Gain/Loss percentage? Gain(700/19 %) Loss(700/19 %) Gain(500/19 %) Loss(500/19 %) If one person ate 100 grapes in 5 days and 6 more each day from starting, what was the no of grapes he ate on first day? 6 8 10 7 If seven men P, Q, R, S, T, U, V parked his car, P and Q something like that. 6 student J, K, L, M, N, O went for picnic in 2 batches, K and L have to go together, M and O do't go together, if O and L go in one batch then which of these combination will be wrong. Jmnp Jklo klop JKLO a boat can go upstream and down stream, if it goes 5/2 times of downstream at the speed of 6 kmph then what will be the speed of upstream? 15 KMPH 12 KMPH 10 KMPH 11 KMPH A, B, C, D, E sitting on a table, A sits 2 seat left from B and C sits 2 seat right from B then what will not be the combination ACDE

4067


What is public, private, protected, internal and internal protected?

904


Are all methods virtual in c#?

900


Which are the loop types available in c#?

893


How do you mark a method obsolete?

949


What is uint64_t?

924


what is the Difference between the public and private ?

887


Is c++ or c# better?

888


Is it possible to inherit multiple interfaces?

960


Is c# queue thread safe?

894


What does executescalar return in c#?

827


Can we inherit abstract class in c#?

869


What is a cshtml file?

990