инициализация
Initializing a two-dimensional dynamic array
I am trying to initialize all the elements of a two-dimensional array when declaring it:
int** ints = new int* [n] { new int ... lays
-842150451
-842150451
-842150451
-842150451
-842150451
, and such:
int* ints = new int[5] { 0 };
-
0
0
0
0
0
.
C++, initialization of constexpr fields
Please tell me, is it possible to initialize the constexpr member not in the header, but in the implementation file?
For exa ... ject
{
public:
constexpr size_t VALUE;
};
// cpp
constexpr Object::VALUE = 1U;
If possible, how?
If not, why not?
Why does this work in gcc?
A static array with a size not known at the time of compilation.
char buf[atoi(argv[2])];
And where can I read about it?
Initialization to the Yii framework.
Do not judge strictly I am just starting to master OOP, so I ask you to help me understand one line of the Yii framework code ... lass extends "YiiBase", but it doesn't have a "run ()"method. And, in general, how can a static method have a method? Thanks.
Initialization of the C and C++structure
There is a structure of the form
typedef struct struct_name {
struct another_struct_name {
typefield1 fie ... p = {&some_an_s};
const struct_name_t name = {temp};
Similar error.
How to initialize this structure correctly in C++?
Why do we need function prototypes? Why do I need to declare variables?
Why do we need function prototypes? Why do I need to declare variables? Why is it impossible to immediately declare a functio ... cout << S;
cout << "\n=======================\n";
}
Is it possible to do without a Prototype?
Initializing a vector in the constructor
class A {
public:
A(size_t size):vector(size, default_value){}
private:
std::vector<int> vector;
const int default_ ... Why is the vector initialized with a random value? Does the constant not have time to become -1 yet? How to do it right then?
Is there any way to simplify class initialization in Python?
I have a class constructor of something like this:
class A:
def __init__(self, a1, a2, ..., an):
self.a1 = a1
... ask one more question: What should I do if some arguments have a default value, and some arguments have a default value? no?
Why did the static initialization block execute after the constructor?
Good day colleagues!
In the literature, it is written that when loading a class, the static block is executed first, and the ... я точка входа
}
}
OUTPUT:
Динамический блок
Конструктор
Статический блок
Question: How to explain the observed behavior?
C++ order of initialization of class members
In what order will the initialization of class members take place in C++? Will the class constructor be called first, or will ... first?
class A {}
class B
{
public:
B() = default;
private:
A a;
static A a0;
int i;
static int i0;
}