from term test Flashcards
what is the dynamic type of c?
Car c = new Honda();
Honda type
in Java, a variable of type Z can hold a reference to:
an instance of type Z or an instance of any subclass Z
T/F
In Java and C++, it is possible to declare objects as either stack-based or heap-based
false
T/F
In C++, variables on the stack are deallocated automatically
true
Writing a method in a subclass that has the same signature as a method in the parent class, when polymorphism is not used is called:
shadowing
What is the purpose of OCCF?
To define a standard way of handling object construction, copying, assignment, and destruction to avoid resource leaks and undefined behaviour
T/F
You should override the copy constructor whenever possible to ensure a deep copy is made by default
false
In C++ when is the copy constructor automatically called?
- when making an object from another
- Person p = q - when passing the object as a value parameter
- when returning an object (not a pointer)