Announcement of class object



  • In class. A There's a default designer and a designer with one parameter.

    With that. A x(); and that A x; announcements of class object A different actions are carried out. Why?



  • A x(); - this is an announcement of the function. x which returns the result to the type A

    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;




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2