Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In detail please and thank you. Consider the following class definitions. Write

ID: 3668084 • Letter: I

Question

In detail please and thank you.

Consider the following class definitions. Write the definition of the default constructor of smart so that the instance variables of smart arc initialized to 0 . Write the definition of the default constructor of super Smart so that the instance; variables of super Smart arc initialized to 0 . Write the definition of the member function set of smart so that the instance variables are initialized according to the parameters. Write the definition of the member function sum of the class smart so that it returns the sum o! the instance variables. Write the definition of the member function manipulate of the class super Smartso that it returns the (x + y)^z , that is, return x plus y to the power of z

Explanation / Answer

I have declared constructors as per your requirement.

a) Answer:

class smart
{
publc:
void print() const;
void set(int , int);
int sum();
smart();
smart(int a,int b);
private:
int x;
int y;
int secret();
};
smart::smart() // default constructor
{
x =0;
y=0;
}
smart::smart(int a, int b) // constructor with two arguments.
{
x =a;
y =b;
}   
  

b) Answer:
class superSmart: public smart
{
public :
void print() const;
void set(int a , int b, int c);
superSmart();
superSmart(int a , int b, int c);
private :
int z;
}
superSmart::superSmart() // default constructor.
{
z =0;
}
superSmart::superSmart(int a, int b, int c); // constructor with arguments.
{
z =c;
};

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote