(11-14-2018, 04:05 AM)DerVVulfman Wrote: The @ symbol is confusing? Well, it basically means that the variable belongs to THAT particular class.
If I made a class called Shelley and a class called Miriam, each might have a variable called @hair_color. I could set the @hair_color variable in the Shelley class to 'sandy_blonde', and set the @hair_color variable in the Miriam class to 'auburn_brown '. Each has its own variable, even though they have the same name. If I tried using the $hair_color value in either class, one would overwrite the other.
STUDY TIME: Look at any of the initialize methods in the default classes. They tend to have @instance variables belonging just to them.... mostly.
Oh, wow. Um... Yeah. Xerox is the manufacturer of a a popular office copy machine. In fact, it was the essential STANDARD for copiers. So back in the day, we just called copiers 'Xerox', just like how we call adhesive bandages 'Bandaids'
Hey, I use phrases like 'oft' for often and other old phrases from before I was borne. BUT I don't think I have ever used 'nary'.
So when I said "that your child is a literal XEROX of the parent", I meant it was a near-perfect copy or duplicate. And well, yeah. The super() statement is a way of letting you add new content to an existing method. It's just that the super() statement "IS" the old content and you're writing the new content around it.
Code:def goofy_method
blah_blah_blah_new_statement1
blah_blah_blah_new_statement2
super()
blah_blah_blah_new_statement3
blah_blah_blah_new_statement4
end
We could just say, we're taking the original 'goofy_method' method and adding two more statements to the start, and two more statements when the original method would have been done.
TEST TIME: So, show me an example of a method using the super() statement. Just an interpretation of what you think it means. This is a no pressure thingie. Just a gauge for discussion to see how I'm doing as a teacher and stuff. More like a test on ME.
ok so the @ symbol helps to organize things! even if they have the same name! as long as its in a different line of code it can help differentiate things?
hmm the "super" statements... its like small bakesale!
the original list of items for sale would be muffins and cupcakes and brownies! BUT somewhere down the line a new seller in the bakesale comes in with cookies and tarts! instead of going to the computer and building up a whole new list from scratch and then having to print everything out and replace the old sign they just take a pen and add the new items on at the bottom of the list!
right?
new logo for Yesteryear created by Lunarberry!