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

In class Disk { private: int size; public: Disk(int x) {size = x;} void add (int

ID: 3536907 • Letter: I

Question

Inclass Disk
{
private: int size;
public:
Disk(int x) {size = x;}
void add (int x) { size = size + x; }
~Disk( ) { cout << size << endl; }
};

int main()
{
Disk *p;
p = new Disk(1400);
(*p).add(100);
delete p;
}

------------------ another main( ), call it part B ----
int main()
{
Disk *q;
q = new Disk[3];

my answer to questins was, disk size tatal subjects,

for A(size 1400+100 total 1500)

for B, three disks (1th 100, for 2th 100, and for last one 0) then he saked this question
summary, what would be the output for Main A and B and why?

I have no answer. please some body help on this.

another one was this about the composition as example I used computer and mous.

composition vs inheritance

So I would like you to explain as well. Is a mouse composed of a computer
or is a computer composed of a mouse?

Explanation / Answer

http://cs.fit.edu/~mmahoney/cse2050/how2cpp.html

go for it

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