Tutor profile: Zac M.
Subject: Java Programming
Explain the difference between private and protected data members. When is a good time to use the protected modifier?
A private data member can only be accessed by the members of the class. A protected member can be accessed only by the members of the class and its subclasses. The protected modifier is good to use when you need a subclass to have direct access to methods or variables in a superclass, but would not need a user to access those same variables or methods.
Explain the construction of and define a diatonic chord, and a few different ways to modify the chord.
A diatonic chord is a chord made up of only notes found in the key that one is working in. A diatonic chord is a triad consisting of the root, third, and fifth notes of the scale. So for example, a C Major chord (The key of C consists of the notes C D E F G A B) would consist of the notes C, E, and G. You can start anywhere in the scale and construct a chord, so starting at A we get A, C, and E, the notes of an A Minor chord. There are ways to spice up chords, such as suspending the third to a two or four, augmenting (raise by a half step) the fourth, or adding a major seventh (or two).
Subject: C++ Programming
What is a friend class? How does this differ from a friend function? When might friends be appropriate and what are the dangers?
A friend class is a class that has access to the private members of another class. It is different than a friend function because the entire friend class has access, instead of one function. Friends are appropriate for operator overloading and if you have two classes, for example, child and mother, where anyone can ask the child’s name, but only the mother and child can change the name. Some of the disadvantages of using friend functions/classes are that they can break your encapsulation, a derived class can’t inherit friend functions, and since the friend function/class has access to otherwise private data members, there are security issues.
needs and Zac will reply soon.