Answer to Question #203734 in C++ for python

Question #203734

Answer the questions (i) and (ii) after going through the following class:

class Test

{

char paper[20];

int marks;

public:

Test () // Function 1

{

strcpy (paper, "Computer");


r

marks = 0;

}

Test (char p[]) // Function 2

{

strcpy(paper, p);

marks = 0;

}

Test (int m) // Function 3

{

strcpy(paper,"Computer");

marks = m;

}

Test (char p[], int m) // Function 4

{

strcpy (paper, p);

marks = m;

}

};

i. Write statements in C++ that would execute Function 1, Function 2, Function 3 and Function 4

of class Test.

ii. Which feature of Object Oriented Programming is demonstrated using Function 1, Function 2,

Function 3 and Function 4 together in the above class Test?


1
Expert's answer
2021-06-07T17:21:07-0400

i.

//function1
Test t;
//function 2
char c[];
Test t2(c);
//function 3
Test t3(58);
//function 4
Test t4(c,34);

ii. The feature of Object Oriented Programming is demonstrated using Function 1, Function 2,

Function 3 and Function 4 together in the above class Test is constructor overloading.



Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog