Object Oriented Programming 2. When you retrieve an integer from a collection an
ID: 3710765 • Letter: O
Question
Object Oriented Programming
2. When you retrieve an integer from a collection and modify the integer, what happens to the
corresponding integer stored in the collection? How is this different from retrieving and modifying an
object?
3. What happens to an object created inside a procedure when the procedure finishes?
4. When a property procedure or method in a base class is not appropriate for a derived class, what can
you do?
5. Suppose class B is derived from class A. Class A’s UpdateData method has been over- ridden in class B.
How can the UpdateData method in class B call the UpdateData method in class A?
6. Why are member variables usually declared Private in classes?
7. At the end of the following example, how many Student objects exist?
Dim st1 As New Student
Dim st2 As Student
st2 = st1
8. At the end of the following example, how many Student objects exist?
Dim st1 As New Student
Dim st2 As Student
st2 = st1
st1 = Nothing
9. Suppose that an application at an animal hospital uses two classes: Mammaland Dog. Which do you think
is the base class and which is the derived class? Why?
10. Why does it make sense that you cannot use the Overridable keyword in a private base class
member declaration?
Explanation / Answer
Solution:
2)
Collection classes are the classes which are specialized for the data storage and the retrieval of the data.
Collection uses data structures like Stack, Queue, list, and hash.
The collection is similar to an array
To retrieve an item in a collection by passing an integer to the item as given below:
CollectionName:Item(index)
It is different from an object because when the data is retrieved the object value will also be modified.
3)
The scope of the object remains inside the procedure and the object dies with the lifecycle of the procedure.
4)
In this case, we can override the method by creating one procedure with the same signature.
5)
The updateData method can be called from class A and the value can be changed as
myBase.UpdateData();
I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.