Coming from Java, I'm quite accustomed to being able to include Classes that I've made within other classes eg:
class Pepperoni{
}
class Pizza{
Pepperoni pepperoni;
Cheese cheese;
}
However in C++, it seems to interpret what I see as declarations, as instead: function calls to initialise a 'Pepperoni' class using the default constructor with empty parameters.
What I'm wanting to do is to be able to create a Pizza class and initialise the 'Pepperoni' and 'Cheese' member variables taken from input on it's constructor. ie something like:
Pizza::Pizza(Pepperoni pepperoni, Cheese cheese){
this.pepperoni = pepperoni;
this.cheese = cheese;
}
Is this just wishful thinking? Do I have to do it another way? Have I overlooked wonderful feature of C++?
Thanks!