Consider the following declarations: class xClass { public: void func(); void print() const ; xClass (); xClass (int, double); private: int u; double w; }; Sample Output: Program 2   and assume that the following statement is in a user program: xClass x; a. How many constructors does class xClass have? b. Write the definition of the default constructor of the class xClass so that the private member variables are initialized to 0. c. Write the definition of the constructor of the class xClass so that the private member variables u and w are initialized to the values passed in the functions.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter10: Classes And Data Abstraction
Section: Chapter Questions
Problem 29SA
icon
Related questions
Question

Consider the following declarations: class xClass
{
public:
void func();
void print() const ; xClass ();
xClass (int, double); private:
int u;
double w;
};
Sample Output: Program 2
  and assume that the following statement is in a user program: xClass x;
a. How many constructors does class xClass have?
b. Write the definition of the default constructor of the class xClass so that the private member variables are initialized to 0.
c. Write the definition of the constructor of the class xClass so that the private member variables u and w are initialized to the values passed in the functions. 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Reference Types in Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning