I would really appreciate if someone could tell me whether I understand it well:
class X
{
A a1=new A(); // reference on the stack, object value on the he
In this case a1.VarA would be on the heap as space for it would have been allocated when you did A a1 = new A().
If you just do int i = 5; in a function that will go on the stack but as you explicitly stated a1 was to be allocated on the heap then all value types associated with it will be placed on the heap