Hello,
My question is about creating a hierarchy of Data Types.
I need to code 3 Data Types:
1.) MealPlan
2.) Meal
3.) MealItem
MealPlan represents a daily meal plan. It should have a certain number of meals. An example of MealPlan would be "Healthy" and have a total of 3 meals.
Meal represents a single meal. It should have a certain number of meal items. An example of Meal would be "Meal 1" and have a total of 3 meal items.
MealItem represents a single meal item. It should have a certain number of protein calories, fat calories, carb calories. An example of MealItem would be "Broccoli" and have protein calories of .2, carb calories of .8, fat calories of .1
By using Data Types, I hope to create meal plans, which are made up of meals, which are made of meal items.
The following code creates a Data Type hierarchy for two Data Types. I've examined it closely but i'm still having a hard time recreating it for my needs as stated above.
Type Customer
ID As Long
Nm As String
End Type
Type SpecialCustomer
Spec As Customer
End Type
Sub test()
Dim c As SpecialCustomer
c.Spec.ID = 1
c.Spec.Nm = "Richard"
Debug.Print c.Spec.ID & " " & c.Spec.Nm
End Sub
Looking at this, I know what I'm trying to do is possible - I'm just having a difficult time of it.
Thanks for any and all help!
Bookmarks