//Given the following program , what is the output for each of the numbered lines in main()
#include <iostream>
using namespace std;
class X{
    X() { cerr << "X()|";}
    X (const X&) { cerr << "X(const X&)|";}
    ~X() { cerr << "~X()|";}
    X &operator=(const X&) { cerr << "X::op=|"; return *this;}
class B{
    B() { cerr << "B()|";}
    B (const B&) { cerr << "B(const B&)|";}
    virtual ~B() { cerr << "~B()|";}

    B &operator=(const B&) { cerr << "B::op=|"; return *this;}
class D:public B{
    D() { cerr << "D()|";}
    D (const D& d):B(d),x_(d.x_) { cerr << "D(const D&)|";}
    virtual ~D() { cerr << "~D()|";}
    D &operator=(const D& d) {
    cerr << "D::op=|"; 
    x_ = d.x_;

    return *this;
X x_;   
int main()
//B b[2];
//B b1(b[0]);
B *pb = new D;
//B b1(b[0]);


When I compile and run the program it prints B()|X()|D()|
I do not understand why it is calling X's constructor.

It appears to me that an X object is created as a member of D, which should call X's constructor when a D object is created.