@joshthewaster
@lemmy.worldSo I have struggled with classes and objects but think I'm starting to get it...? As part of a short online class I made a program that asked a few multiple choice questions and returns a score. To do this there are a few parts.
Define some inputs as lists of strings ((q, a), (q2, a2),...). The lists contain the questions and answers. This will be used as input and allows an easy way to change questions, add them, whatever.
Create a class that takes in the list and creates objects - the objects are a question and it's answer.
Create a new list that uses that class to store the objects.
Define a function that iterates over the list full of question/answer objects, and then asks the user the questions and tallies the score.
Number 2 is really what I am wondering about, is that generally what a class and object are? I would use an analogy of a factory being a class. It takes in raw materials (or pre-made parts) and builds them into standard objects. Is this a reasonable analogy of what a class is?
Just started as in, I'm about an hour into a 4 hour intro video. Seeing two basic ways of manipulating things and don't understand the difference.
If I want to know the length of a string and I just guess at how to do it I would try one of these two things,
What is the difference between these types of statements? How do I think about this to know which one I should expect to work?
I think this episode is part one of the holonovel followed by the second part during the second half. The only break we take from seeing the holonovel be played is when they tell captain Janeway (where she implies that she has to be made to look good) about the first half and when Tom and Tuvok are in the mess hall being hassled by everyone who wants to help write the second half.
Tom and Tuvok write the ending off screen (there is dialog where they argue about a logical ending or a wild twist). The Twist is that part two picks up with the player of the novel meeting Tuvok in the hallway to go to the holodeck to help write the ending. When the player gets there they then get attacked by Seska and get to help rescue Voyager while novel character Janeway helps save the day by brilliantly editing the simulation (in a holonovel simulation).