.


:




:

































 

 

 

 





:

-

- ( )

- ( . : ', , , 0 .)

 

:

-

-

-

-

 

++ ' . ' , , . . ' ' . :

- .

- ' 䳿

- , , .

1. , , try.

2. throw.

3. catch{...}, , .

 

catch try. . . catch

 

void main()

{...

try{...F();

throw FileNotFound;

...

G();

Throw TooBig;

...

};

catch(FileNotFound){...}

catch(TooBig){...}

}

 

: . catch. ++ .

 

. . . . . catch , . . catch, . . catch switch. default catch(...), .

 

class Array{

public:

int & operator[](int offSet);

class xBoudry{};

class xTooBig{};

...

};

int &Array::operator[](int offSet){

...

throw xBoundary;

...

throw xTooBig;};

void main(){

...

try {...};

catch(Array::xBoundary){...};

catch(...){...};

};

 

', . [] . catch. catch{...}. , 䳺 . 2

- ,

- , .

 

++ . - . , "" - . . , ', . . . . .

.

, '.

 

temlate <class T>

class Array

{public:

Array(){};

~Array(){};

private:

T * pType;

int Size;

};

 

o tempate . , . ' . class. T , int, Cat. private. main.

 

void main()

{ Array <int> intArray; //

Array <Cat> CatArray; // ' Cat

};

 

, . -, , .

temlate <class T, int; > class Cont{...};

 





:


: 2016-07-29; !; : 1034 |


:

:

, .
==> ...

1293 - | 1214 -


© 2015-2024 lektsii.org - -

: 0.014 .