![]() |
| ||
| Simple Question?? namespace Empleados this mi question if I run this program the results are el empleado 1 tiene 46 años numero de empleados creados 1 el empleado 2 tiene 45 años numero de empleados creados 2 its ok but if i change this code public Empleados(int edad)for this public Empleados(int edad) the results are el empleado 1 tiene 46 años numero de empleados creados 1 el empleado 2 tiene 45 años numero de empleados creados 1 why?? is no the same using ++ than + 1??? or i am wrong?? |
| ||
| Re: Simple Question?? in your case it doesn't matter, which way you use to add 1. I suppose that you was talking about "+=" operator? Let's see: 1. Empleados.numeroemp++;increasing numeroemp by 1. 2. Empleados.numeroemp += 1;which is the short version of this: Empleados.numeroemp = Empleados.numeroemp + 1;3. Empleados.numeroemp = + 1;here you assign numeroemp by +1. |
| ||
| Re: Simple Question?? I was going to add that the two outputs are the same . .. |
| ||
| Re: Simple Question?? The difference is the = +1 is the same as =1 where as += 1 will add one and store it. Typos FTW |
| ||
| Re: Simple Question?? use this Empleados.numeroemp += 1; |
| All times are GMT -4. The time now is 3:23 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC