0
#include <iostream>
using namespace std;

class Point {
private:
    int x, y;
public:

    Point() {
        cout << "default constructer" << endl;
    }
    Point(int x)
        : x(x), y(0) {
        cout << "1 var constructer" << endl;
    };
};

int main() {
    Point x;
    Point y();
    Point z(1);
    return 0;
}

i understand that x is default constructor but i think y is covered by (void) so i thought y should be default constructor but y isn't but when i change y() to y{} then default constructorcalled why is this work like that?? something i have miss?

0 Answers0