Alokir

Alokir t1_je8za6c wrote

The easiest way to picture it is the correlation between meter and centimeter.

1 meter is 100 centimeters, but 2 meters are not 101 centimeters but 200. The relationship is linear because you use a linear function to convert from one unit to the other. In this case it's meter = 100 cm.

In case fahrenheit it's more complex to calculate in your head, but simple if written down: Celsius = (Fahrenheit - 32) x 5/9.

To imagine a non-linear correlation you can think of something like how the amount of chocolate you eat relates to your enjoyment.

You eat a bar of chocolate, that's cool. You eat two, it's better. But as you keep eating more and more you start to get full and by the time you eat your 25th bar of chocolate you'll want to puke. So if you'd want to illustrate it on a chart, the line would start to rise and quickly drop at a point the more chocolate you eat.

The relationship would be linear if your enjoyment would increase by the same logic regardless of how many chocolate you ate (or more precisely, if there was a linear function that you could use to calculate it).

Edit: clarification

1

Alokir t1_ixh5d3p wrote

This. His goal is the stay in power no matter what.

He goes from communist rhetoric to race theory in a matter of days, it always depends on who he wants to win over to his side at the time.

He's not at all far right, he's an opportunist who loves power too much and he's willing to drive the country down a cliff to keep it for a while longer.

7

Alokir t1_ixege0v wrote

Think of a class as a concept in the real world, like Dog or Animal. A class contains all data definitions and functionality necessary to work with this concept.

The functionality that relates to these concepts are called methods. For example, a Dog can bark, walk and wiggle its tail.

If you want to talk about a specific Dog you use the Dog class as a blueprint and create a dog object. Each time this happens the constructor is called automatically, which is a special method that is meant to set the initial values for the newly created object.

A struct is a way to group data together, it's easier to handle than having many individual variables.

1