You are using
new
:
Program obj = new Program( );
ProgramB objb = new ProgramB( );
And without them, your program woudln't work.
Let's just step back a bit and look at what
new
does.
When you declare a variable:
Program p;
You allocate memory for a
reference to a Program object: that doesn't create an instance of a Program class. That isn't created until you explicitly say "give me a Program instance" via the
new
keyword:
p = new Program();
It's like a car parking space: it's a variable that can contain a car, but until you park there it is empty: you can't leave your house, start the car, and drive away. The
new
keyword "parks the car in the parking space" and now you can drive to the shops!