3. If the ++pointer style is necessary, then create a temporary pointer for the job and keep the myWeapons firmly at the beginning of the block at all times.
4. A new without delete is (1) bad habit and (2) the inspiration for many things in the standard library.
3. If the ++pointer style is necessary, then create a temporary pointer for the job and keep the myWeapons firmly at the beginning of the block at all times.
weapons()=default;
weapons(string Name,int Value, int Qty):name(Name),value(Value),quantity(Qty){}
The first one is the struct default constructor , the keyword =default request the compiler to synthesis the constructor instead of you providing an explicit definition, The second one is an explicitly defined constructor that takes the parameters specified within the braces,
I added them for the sake of formality because your struct possibly would do without them, am sure an aggregate class will accept implicit conversion from your initi-list during intialization.
Probably not because both your array and function identifiers have a similar signature, both of them can be converted to pointers am sure that might be quite problematic to a person reading your code or even possiblly to the compiler itself
Also your function should be returning a value.
how this works i mean the weapons myWeapons();
here myWeapons() is a function that returns an object of type weapons.