Question: Please help me with this C++ example. I will provide the given codes below the pictured instructions. thank you so much ------------------------------------------------------------------------------------------------------------------------- // word5.h #ifndef

Please help me with this C++ example. I will provide the given codes below the pictured instructions. thank you so much

Please help me with this C++ example. I will provide the given

codes below the pictured instructions. thank you so much ------------------------------------------------------------------------------------------------------------------------- // word5.h

-------------------------------------------------------------------------------------------------------------------------

// word5.h

#ifndef _WORD5_H #define _WORD5_H

class Word { private:

char *buf;

static int wordCount; public:

Word(char *s);

int getCount(); };

#endif

-------------------------------------------------------------------------------------------------------------------------

// word5.cpp

#include #include "word5.h"

int Word::wordCount = 0;

Word::Word(char *s) { buf = strdup(s);

wordCount++; }

int Word::getCount() {

return wordCount; }

& Static Homework 1. Add a destructor Create a destructor to the Word5 class below which decrements wordCount. a driver for your code and show that your destructor works. // word5.h tifndef WORDS H tdefine WORDS H class Word f private: char *but: static int wordCount: public: Word (char *s); int getCount ) tendif /1 words.opp include finclude "word5.h" int word:: wordcount Word: : Word (char s) 0; buf strdup [s) : wordCourit++ int Word: :getCount) ( return wordCount: 2. Write some code that shows the this pointer is passed into normal member functions but not static member functions. function. -..create an object of that class and, inside a for loop, call both functions da. Create a class that contains a normal member function and a static member 3a. multiple times Page 285 rcus on Object-Oriented Programming with C++

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!