S
S
sergeyviktorovich2021-05-31 22:58:48
C++ / C#
sergeyviktorovich, 2021-05-31 22:58:48

Change image size in checkout?

where the size of the image changes in the checkout product, the layout is enlarged in poor quality

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Zagaevsky, 2019-01-31
@vladislav9619996

static should not be removed, the meaning of this B is to calculate how many instances of class A are created (static means that the same object in this variable is visible from all places in the program).
From this point of view, access to a statistical variable through a pointer to an instance of a class is not entirely correct ( a->storage.counter). I would have expected to see A::storage.counter.
delete [] in the destructor to AA, here you correctly noticed. It is this form of delete that must be used, because memory is allocated for an array (new int[10]). In other places, 1 object is allocated, so you need to delete without [].
But, in order for the destructor AA to be called when the pointer to A is deleted (auto a = new A; will deduce the type A *), when this pointer contains an object of class AA, you need to declare the destructor virtual ~ A (and not virtual ~ AA at all) . In this case, declaring AA as a virtual destructor will not be an error in itself.
someValue++ in the AA constructor is quite pointless, because this is a class A field that is simply initialized to zero. As a result, in all instances of AA there will be 1. It is not clear what they were trying to achieve.
You should use operator<< instead of printf in C++, but I don't think the jerk who wrote that test thought much about it.
Didn't notice anything else.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question