Также вы можете использовать LINQ. Например, для прозрачного текста Textbox
сделайте что-то вроде:
this.Controls.OfType<TextBox>().ToList().ForEach(t => t.Text = string.Empty);
На соответствующем компиляторе вы получаете ошибку компиляции.
Следующий код:
class Something
{
public:
Something(int whatever) : whatever_(whatever) {}
private:
int whatever_;
};
Something something;
При компиляции с gcc8.2 приводит к следующей ошибке компиляции:
<source>:9:11: error: no matching function for call to 'Something::Something()'
Something something;
^~~~~~~~~
<source>:4:5: note: candidate: 'Something::Something(int)'
Something(int whatever) : whatever_(whatever) {}
^~~~~~~~~
<source>:4:5: note: candidate expects 1 argument, 0 provided
<source>:1:7: note: candidate: 'constexpr Something::Something(const Something&)'
class Something
^~~~~~~~~
<source>:1:7: note: candidate expects 1 argument, 0 provided
<source>:1:7: note: candidate: 'constexpr Something::Something(Something&&)'
<source>:1:7: note: candidate expects 1 argument, 0 provided
Compiler returned: 1
Живой пример доступен на godbolt .