fork(1) download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. class A {
  4. public:
  5. A() { cout << "Constructor\n"; }
  6. };
  7. int main()
  8. {
  9. //A* a1 = (A*)malloc(sizeof(A)); // ❌ constructor NOT called
  10. A* a2 = new A();
  11. }
Success #stdin #stdout 0s 5308KB
stdin
4
abas 
ytre
wsed
rtft
stdout
Constructor