Tutor profile: Evan P.
Questions
Subject: Java Programming
In Java, how do you create a class that can be used as multiple different types?
Through the use of inheriting interfaces. Unlike in C++ where multiple classes can be inherited, in Java, only one class may be inherited, but many interfaces may be inherited. This results in the general pattern of inheriting contracts and composing functionality.
Subject: C++ Programming
In C++, what benefit do generic classes provide?
Generic classes allow you to define a class that can work with multiple different types of data, as long as that type adheres to the "contract" specified in the template parameters.
Subject: C Sharp Programming
In C#, what do you need to do to correctly handle the freeing of resources used by an instance of a class (i.e. an object) that you are creating?
Memory-based resources (such as simple variables and other objects) that are class members do not require any special actions (except some rare cases). Resources such as database connections (and other session-like) resources may need to be closed if those objects do not explicitly handle closing themselves when they are destructed, or if an object for the resource is not held (such as if a session key is used).