Tutor profile: Sepehr H.
Subject: Basic Math
How can you add two fractions with different numbers on the bottom?
You need to find a way to change the fractions so that they both have the same number on the bottom. You can do this by multiplying the top and bottom numbers of a fraction by the same number. For example, if you have 1/2 + 1/3, you can multiply 1/2 by 3 and change it to 3/6. Then take 1/3, multiply by 2 and get 2/6. Now you have two fractions with the same bottom number and can easily add them together.
Subject: C++ Programming
What is the difference between inheritance and polymorphism?
Inheritance is more concerned about reusing code to improve efficiency and reduce code size. When we know that multiple classes will have the same chunk of code in all of them, such as multiple vehicle classes all requiring an engine, we can make a parent class that includes this repeated code, and make all our vehicle classes inherit from this parent class, having access to the attributes in the parent class. Polymorphism is a technique used primarily by functions/methods that allow the calling object to decide what version of a function to use, either at run time or compile time. For instance, there could be two classes Dog and Cat each with their own version of a method called feedAnimal(). If we were to call this feedAnimal() method in our code, polymorphism allows C++ to know which version to call based on the object calling it, either at run-time or compile-time
Why can you not take the square root of a negative number?
To take the square root of a number, there needs to exist a number that when multiplied by itself, becomes the number we square rooted. It is not possible to do this for a negative number. Any positive number multiplied by itself will be positive, and any negative number multiplied by itself will also be positive. Thus you can never multiply a number by itself and get a negative, meaning you cannot square root a negative number.
needs and Sepehr will reply soon.