Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ 1 Given the class and declarations above, which of the following code is valid (will compile)? a. Qq.num = 4; b. ask.code= 4; c.

C++

1 Given the class and declarations above, which of the following code is valid (will compile)?

a. Qq.num = 4;

b. ask.code= 4;

c. ask.setCode(6);

d. ask.num="14";

e. ask.text="Qq.num";

2) Assuming there is a valid class called MyBook, what is wrong with the following header?

int MyBook::MyBook()

a. This is a syntax error since it looks to be a constructor, but constructors cannot return a value.

b. This is a syntax error because MyBook is not a valid class name.

c. An error because this is an accessor and the method name must begin with the word get.

d. An error because method names cannot begin with an uppercase letter.

e.This is an error because constructors must always accept at least 1 parameter.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions