Paul Clapham wrote:No. Janeice was right -- create a class which contains (something like) an apartment name and a date. Concatenating strings is a really really bad way of designing an object. You'll need to write an equals() method which can compare two of these Occupancy objects, or whatever you decide to name your class.
Campbell Ritchie wrote:Can you create some sort of calendar to be attached to the Apartment object? Then an Occupancy object which incorporates a timespan?
That question looks like something which is easier to handle in SQL.
Ilya Mechnikov wrote:I hoped someone could mention the name of a structure suitable for storing unique combinations of 2 variables that I can check against.
I came across "set" and think this might do the trick:
I would concatenate the 2 variables and check them against a set.
Janeice DelVecchio wrote:P.S. starting with learning regex / pattern matching before understanding how to instantiate an object is also a very bad plan.
You don't need to extend anything or override. As Janeice has told you, you can probably do this without inheritance.
Ilya Mechnikov wrote:. . . Once I learn to create objects, extend classes, override methods, etc.... . . .
Janeice DelVecchio wrote:It's actually pretty easy to create an object and use it. What do you use for reference materials?
There's no reason not to learn things the right way. It's not hard or complicated and it might only take you a couple hours total to get the job done well.
There's also no excuse if you've come from coding perl. Its a bit watered down, but uses many similar OOP concepts.