first It defined a class (rectangle)that It has two private member,then we see two line inside public.
one is :Rectangle(int w = 1, int h = 1):width(w),height(h){}
i don't undestand nothing from it.what does it mean ?is this line function or constructor?
other is :
declaring friend function:friendvoid display(Rectangle &);
what does (Rectangle &) mean?why is Rectangle &؟ inside argument
and in the below code:
i don't understand arguments inside friend function.how do we name arguments for friend function?should not it be for example (int y ,float x)
plz explain me alot.i don't know nothing about arguments inside friend function.
tanx

i don't undestand nothing from it.what does it mean ?is this line function or constructor?

A constructor is a function. A function is not necessarily a constructor. That one is a constructor

what does (Rectangle &) mean?why is Rectangle &؟ inside argument

It means "a reference to an object of type Rectangle". It is inside because the function takes a reference to an object of type Rectangle as parameter

i don't understand arguments inside friend function.how do we name arguments for friend function?

You don't need to give names to parameters of friend functions. The parameters names are mandatory only in the function definition. Since a friend function is only a declaration (telling the compiler that somewhere in the code there is a function, with a certain return type that takes a certain set of parameters, that can access the private members of the class it's decalred in) you can name its parameters however you want or not name them at all.

Rectangle(int w = 1, int h = 1):width(w),height(h){}
i don't undestand nothing from it.what does it mean ?is this line function or constructor?

It is both function and constructor. The declaration part Rectangle(int w = 1, int h = 1) says the constructor takes two arguments; w and h. w and h have default values of 1 which means if they're not supplied, 1 is assumed. The initialization portion : width(w),height(h) says that the member width is initialized to w and that height is initialized to h.

friend void display(Rectangle &r);
what does (Rectangle &) mean?

A friend function is global in scope and although it can reference members of the class, it is itself not a member of the class, therefore the Rectangle that is to be displayed must be passed as an argument. Note that I added r as an argument name. It's not required. Just a sylistic preference.

123

void display(Rectangle &r)
{ cout << r.width * r.height << endl;
}

Again note that display is defined as a global function (it's not Rectangle::display).
The rectangle you want to display is passed as an argument. Note that because it was declared as a friend function, it can access width and height which are private members of r.