- Consider The Following Two Program Segments 1 And 52 St Base Class Class Rational Error Cout Name Endt 1 (22.83 KiB) Viewed 10 times
Consider the following two program segments: $1 and 52 St: Base class class rational [ error() [ cout <
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Consider the following two program segments: $1 and 52 St: Base class class rational [ error() [ cout <
Consider the following two program segments: $1 and 52 St: Base class class rational [ error() [ cout <<name() << endt) string name() { return "Rational R}} Derived class: class complex rational [ string name() { return Complex - rational A: complex B; S2 Same as St, but name is defined as: virtual string name() { return "Rational":] What is the correct answer: ? O a Considering St, A.error() <= error will call name() in rational and Berror() error will call name()in rational b. Considering S2: A.error() error will call name() in rational and Berror will call name in complex O c. a and b Ⓒd. in S1 and 52, if error is called Rational is always printed Ⓒe none of the mentioned