03.01.2015 Views

Complete set: Intro to C - Bill Buchanan

Complete set: Intro to C - Bill Buchanan

Complete set: Intro to C - Bill Buchanan

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

8 More Objects<br />

8.1 <strong>Intro</strong>duction<br />

This module covers the key elements of arrays, indexers and collections. It covers:<br />

• Interfaces.<br />

• Construc<strong>to</strong>rs.<br />

• Destruc<strong>to</strong>rs.<br />

• Static and instance members.<br />

• Practical example.<br />

8.2 Interfaces<br />

An interface is an alternative method of creating an abstract, but it does not contain<br />

any implementation of the methods, at all. It provides a base class for all the derived<br />

classes. For example, in Figure 8.1 we have a circuit which can either have a series or<br />

a parallel resistance.<br />

Series circuit: R T<br />

= R 1<br />

+ R2<br />

Parallel circuit:<br />

R1<br />

⋅ R2<br />

R T<br />

=<br />

R + R<br />

1<br />

2<br />

duction <strong>to</strong> .NET<br />

<strong>Intro</strong><br />

Circuit<br />

R T<br />

= R 1<br />

+ R2<br />

r 1 r 2<br />

r 1<br />

r 2<br />

R ⋅ R2<br />

R<br />

1<br />

R T<br />

=<br />

R1<br />

+<br />

Figure 8.1: Circuit with series and parallel resistance<br />

2<br />

Agilent .NET Course: More Objects 2

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!