C# 0 The Complete Reference


PART I C h a p t e r   6



Download 4,07 Mb.
Pdf ko'rish
bet196/1096
Sana23.01.2022
Hajmi4,07 Mb.
#402171
1   ...   192   193   194   195   196   197   198   199   ...   1096
Bog'liq
C-Sharp 3 The Complete Reference Herbert Schildt


PART I

C h a p t e r   6 :  

I n t r o d u c i n g   C l a s s e s   a n d   O b j e c t s  

133


PART IPART I

      ob.Generator(count);

    Console.WriteLine("Done");

  }


}

Here is how the program works. The constructor sets the instance variable 



x

 to a known 

value. In this example, 

x

 is used as an object ID. The destructor displays the value of 



x

 when 


an object is recycled. Of special interest is 

Generator( )

. This method creates and then promptly 

destroys a 

Destruct

 object. The 



DestructDemo

 class creates an initial 



Destruct

 object called 



ob

. Then using 



ob

, it creates 100,000 objects by calling 



Generator( )

 on 


ob

. This has the net 

effect of creating and destroying 100,000 objects. At various points in the middle of this 

process, garbage collection will take place. Precisely how often or when is dependent upon 

several factors, such as the initial amount of free memory, the operating system, and so on. 

However, at some point, you will start to see the messages generated by the destructor. If 

you don’t see the messages prior to program termination (that is, before you see the “Done” 

message), try increasing the number of objects being generated by upping the count in the 



for

 loop.


One important point: The call to 


Download 4,07 Mb.

Do'stlaringiz bilan baham:
1   ...   192   193   194   195   196   197   198   199   ...   1096




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish