Declare, by a hand, the interface of a C++ class, showing all public and private
ID: 3650336 • Letter: D
Question
Declare, by a hand, the interface of a C++ class, showing all public and private information, of a digitalimage on a cell phone. An image has both a height and width (in pixels), is either grayscale (black-andwhite) or color and may or may not contain human faces. The class should contain individual functions to both
get and set the height and width and the presence or absence of color in an image. A boolean function
indicates if any faces are present in an image. A default constructor should be given, as well as one that sets
the height, width and color information of an image. A function to load an image from a file into a given
instance is needed. This function should receive a string representing the path of the image file, such as
C:Picsimage.BMP. Lastly, a private helper function to detect faces in an image is needed.
Explanation / Answer
class ImageInterface { protected : int height; int width; bool color; public: ImageInterface(int w, int h, bool c) { setwidth(w); setheight(h); setcolor(c); } int getheight(); int getwidth(); bool getcolor(); void setheight(); void setwidth(); void setcolor(); }
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.