.


:




:

































 

 

 

 


-ү. -ү. ң қ




 

++- ә ң -ү қғ, ң -ү қ қ .

 

-ү - ұ ң -ү

 

-ү ө ң қ ө .

-ү ң қ қғғ ә қ ө

-ү ң (C++) қ ү. ң қғ -ү inline.

-ү ғ ө -ү қ.

-ү қ ғ this .

-ү static . ұ ң қ ө ө . ң қ -ү const virtual . ұ ғ ң қ ң , ң ғ қғ .

 

4.5.

Class Shape {

Static int num; point center; public:

 

shape (Point c): center (c) {++num;} ~Shape() {--num;}

Static int Num(){return num;} };

Int Shape::num=0; Void main()

 

{cout <<Shape::Num(); //0 Shape s;

Cout <<Shape::Num();//1

for (int n=Shape::Num(); n>0; n--){}

}

 

-ү constқ , ұ ғ

 


ө ә ң ө ұқ қғ ү . ұ -ү қ .

 

7 . ә : ә ә . ++- ә ә. . ә ң

 

ң ү ұ ң қ . Ү қғ . :

 

table tblvec[10];

 

қ , қ , ө table::table(int sz=10) ү ү қ. ң қ. table ң ү table , :

 

class table {    
void init (int sz); // қ
public:        
table (int sz) { i n i t (s z); } /*ұғ қ ү */
tabl e () { init (10); } //ү
};        

 

ғ , ң ә ү қ. new ө ғ ү қ . қ- ғ ү ұ қ , ғғ ұқ ң ғғ ұқ . :

 

void f() {

table * t1 = new table; table * t2 = new table[10]; table * t3 = new table[10]; delete t1; //

 

delete t2; // : 10 delete[] t3;

}

 

ң ң ң , ө ң ң ө ә .

ң ң құғ ң қ . ң , ң ң , ү. ң ң ө , қғ ү ң ө . ұ ү , қ ө . ң ө ү қ , қ қ ң ө ү ү.

 


class Phone { int a,b,c; public:

Phone(int al,int bl,int cl):a(al), b (bl), (cl) {} };

 

Phone office []= {/*өө*/

900, 800, 905, 6 7 8, 4 5 6, 5 4 6 };

Phone office [ 3 ] = {/*Ү ,Phone- қ*/

890, 790,343, 238, 279, 564 };

 

class int{

int *v, size, top; public:

int pop();

int Top() const; /* ө */

};

Void =s.Top(); /*ұ: Top() ү*/ Int b=s.Pop(); /*Қ: s*/

 

}

 

class A{ int a; public:

A() {a=10; }

int & get() const; /*Қ қ*/}; int & A::get() const;{

return a;}

int main (int argc, char* argv[]){A b; cout << b.get();

return 0;

}

 






:


: 2017-01-28; !; : 860 |


:

:

, , 1:10
==> ...

1891 - | 1804 -


© 2015-2024 lektsii.org - -

: 0.01 .