There are basically two types of variables in Common Type System ?
1) Value Type - Get Stored on Stack Memory.
2) Reference Type - Get Stored on Managed Heap Memory
How this Works?
Value types get stored on stack and shared the same process memory, however the Reference Types get stored on Heap and their memory address value gets stored on the stack as value type.
Question: When an object (child Object) is instantiated inside an object (parent Object) where does it get stored?
Answer: The value of child object (Reference type) gets stored in another random memory area on the managed heap and its reference (memory address value) gets stored in the managed heap of the Parent Object as Value Type.
The value of child object (Value type) gets stored in the Parent object's memory area of the managed heap.
Module Module1 'Main Entry
Dim i As Integer = 50
Dim objA As classA = New ClassA
Dim j As Integer = 25
Public Class ClassA 'Parent Class
Dim obj As New ClassB
Dim MoreInfo As String = "sample"
Public Class ClassB 'Child Class
Public name As String
Public age As Integer
As you can determine from the figure, that value of the ObjA gets stored in the Managed Heap and its memory address value gets stored on the Stack. But, in case of ObjB the value of the ObjB gets stored at another location in the Managed Heap and the memory address value of this location gets stored as a value type in ObjA Managed Heap.