یعنی از یک متد بارهاوبارها پی در پی استغاده شود.
Ex:
Public int sum (int a , int b) => a+b;
Public int sum (int a , int b , int c) => a+b+c;
Public int sum (int a , int b , int c , int d) => a+b+c+d;
مثالی از Overloading ومتدسازنده:
Ex1:
Public class RectBox
{
Private int _width;
Private int _height;
………………
Public RectBox( )
{
_width = 0;
_height = 0;
}
Public RetBox ( int w, int h)
{
_width = w;
_height = h;
}
}
RetBox b1 = new RectBox( );
RetBox b2 = new RectBox( 10,20 );
برچسب:
نویسنده: زهرا نوروزی