C# 0 The Complete Reference



Download 4,07 Mb.
Pdf ko'rish
bet410/1096
Sana23.01.2022
Hajmi4,07 Mb.
#402171
1   ...   406   407   408   409   410   411   412   413   ...   1096
Bog'liq
C-Sharp 3 The Complete Reference Herbert Schildt

ISeries

,

ByTwos

, and 

SeriesDemo

 in the compilation. The compiler will automatically compile all three files to 

create the final executable. For example, if you called these files 

ISeries.cs

,

ByTwos.cs

, and 

SeriesDemo.cs

, then the following command line will compile the program:

>csc SeriesDemo.cs ISeries.cs ByTwos.cs

If you are using the Visual C++ IDE, simply add all three files to your C# project. One other 

point: It is perfectly valid to put all three of these classes in the same file, too.

The output from this program is shown here:

Next value is 2

Next value is 4

Next value is 6

Next value is 8

Next value is 10

Resetting

Next value is 2

Next value is 4

Next value is 6

Next value is 8

Next value is 10

Starting at 100

Next value is 102

Next value is 104

Next value is 106

Next value is 108

Next value is 110

It is both permissible and common for classes that implement interfaces to define 

additional members of their own. For example, the following version of 

ByTwos

 adds 


the method 

GetPrevious( )

, which returns the previous value:

// Implement ISeries and add GetPrevious().

 class ByTwos : ISeries {

  int start;

  int val;

  int prev;

  public ByTwos() {

    start = 0;

    val = 0;

    prev = -2;

  }


www.freepdf-books.com


Download 4,07 Mb.

Do'stlaringiz bilan baham:
1   ...   406   407   408   409   410   411   412   413   ...   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