C++ programming Using the attached header file , create the companion . cpp file
ID: 3807176 • Letter: C
Question
C++ programming
Using the attached header file, create the companion .cpp file
#pragma once
#ifndef CRAYONBOX_H
#define CRAYONBOX_H
#include
using namespace std;
class CrayonBox {
private:
string brand;
int numInBox;
static int numBoxes;
string * colors; // pointer to dynamically allocated array of size numInBox
void setColors(string *, int); // sets up array of colors
public:
CrayonBox(string, int, string *);
~CrayonBox();
static int getNumBoxes() { return numBoxes; }
int getNumInBox() { return numInBox; }
string getBrand() { return brand; }
void setNumInBox(int);
void printBox(); // print brand, numInBox, and colors
};
#endif
Explanation / Answer
#pragma once
#ifndef CRAYONBOX_H
#define CRAYONBOX_H
#include
using namespace std;
class CrayonBox {
private:
string brand;
int numInBox;
static int numBoxes;
string * colors; // pointer to dynamically allocated array of size numInBox
void setColors(string *, int); // sets up array of colors
public:
CrayonBox(string, int, string *);
~CrayonBox();
static int getNumBoxes() { return numBoxes; }
int getNumInBox() { return numInBox; }
string getBrand() { return brand; }
void setNumInBox(int);
void printBox(); // print brand, numInBox, and colors
};
#endif
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.