Please see the code bellow:
class A {
public x = 5;
public y = 6;
public z = 7;
}
class B extends A {
public m = 1;
public n = 2;
}
$a = new A();
$b = new B()
From the above code let $a is allocating x amount of memory and $b is allocating y amount of memory;
Now my question is which one is correct from bellow?
x > y
x < y
These are my numbers:
Thus
x < yThese two class definitions are equivalent
Meaning that were you to change the definition of B into that of C then the memory usage would be the exact same for using new B() or new C().
To run it yourself use this code (as an example)