|
-
Feb 1st, 2018, 12:41 AM
#20
Thread Starter
Addicted Member
Re: Properties, Enumeration, & Constructors
 Originally Posted by OptionBase1
There are several ways that you could set up the Aisle property. There are pros and cons to all of them, some involve more lines of code, like using an enumeration, and more complex code. The way you've done it by defining Aisle as a String is probably the easiest way to do it. You would then assign an aisle to it like this:
Code:
myGroceryItem.Aisle = "Bakery"
Note, however, that the way the Aisle property is configured, there's nothing stopping you from assigning a product to an Aisle not in the list, like this:
Code:
myGroceryItem.Aisle = "AisleThatDoesNotExist"
but the instructions you posted didn't specify that you need to worry about that.
So I would say you are up to the point where you need to set up the 2 Constructors.
So would I have to do this for each Aisle?
Code:
myGroceryItem.Aisle = "Bakery"
Also, I thought that the constructors is what was in my GroceryItem code with Get & Set statements?? So constructors are something different?
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|