-

 -

  • (72)
  •     (45)
  • (37)
  • (1)
  • (0)
  • (23)

 -

 - e-mail

 

 -

   TheLenka

 -

 LiveInternet.ru:
: 03.01.2009
:
:
: 265

:


.

, 24 2009 . 16:09 +



- , . ¬ , . ¬ , ¬ C++ . ¬ , ¬, .
¬ . ¬ . ¬ () , ¬ .
- , ¬. . (~) . . ¬ , .

class Place  
{ //
int x, ;
public:
int Getx()  
{  
return x;  
}
int Getyf)  
{  
return y;  
}
Place (int newx, int newy) ; //
};
Place: :Place (int newx, int newy) //
{  
x = newx;  
= newy;
}  

Place:

Place PL (320, 240) ; // VGA

. .
. , . , , . :

Place (int newx, int newy = 0)
{
x = newx;  
= newy;
}
, , Place FP(320), = 320 = 0 ( ).
( , ) . , . , . ( ), . .
new,

Place FirstPoint = Place(320,240);
Place *Ptr = new Place(320,240);

. return: return Place(100,100);
o !) . . .
. :
Place Loc; //
... Loc . ~Place () ; // ,
, .


– , . :

class Point
{
public:
 int x,y;
 Point ():x(50),y(50) {} // -
 Point (int nx,int ny) //
 {
 x=nx+30;
 y=ny+40;
 }
 void Show()
 {
 cout<<"("<<x<<","<<y<<")"<<endl;
 }
};
void main()
{
 Point pu;
 pu.Show(); //(50,50)
 Point pp(100,100); //(130,140)
 pp.Show();
 Point pc=pp; //(130,140) (1)
 pc.Show(); 
 Point pc1(pp); //(130,140) (2)
 pc1.Show();
}

Point, . (1) (2) . . . , .

?

Point (const Point &np)
{
 x=np.x+50;
 y=np.y+50;
}

, , . , , .

Point pp(100,100); //(130,140)
pp.Show();
Point pc=pp; //(180,190)
pc.Show(); 
Point pc1(pp); //(180,190)
pc1.Show();

, .

Point *pp=new Point(100,100); //(130,140)
pp->Show();
Point *pc1=new Point(*pp); //(130,140)
pc1->Show();
, . . , .
 

Point *pc=pp;
, , .

 Point *pp=new Point(100,100); //(130,140)
 pp->Show();
 Point *pc=pp;
 pp->x+=15;
 pp->Show(); //(145,140)
 pc->Show();//(145,140)

, pp, , , pc, , , .



 


: [1] []
 

:
: 

: ( )

:

  URL