Announcement of class object
-
In class.
A
There's a default designer and a designer with one parameter.With that.
A x();
and thatA x;
announcements of class objectA
different actions are carried out. Why?
-
A x();
- this is an announcement of the function.x
which returns the result to the typeA
♪In C and C++, functions can be declared in t and within functions, for example
int main() { int f(); // объявили функцию, которая будет определена ниже. return f(); }
int f() { return 0; }
To declare the variable, use the figure brackets:
A x{};
Or just use it.
A x;
♪