Shanil P.

asked • 10/15/20

Lab for CS112 Data Structures and Algorithms

Answer this and please explain so that it is easy to understand the following questions and the explanation given.

Suppose the class Sub is derived from the class Sandwich. Which of the following assignments are legal?

a) Sandwich* x = new Sandwich(); a) Sub* y = new Sub();

b) x = y;

c) y = x;

d) y = new Sandwich();

e) x = new Sub(); f) *x = *y; g) *y = *x;

1 Expert Answer


Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.


Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.