Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ header files My header file looks like this: #ifndef PPMIMAGE_H_ #define PPMIMAGE_H_ class PpmImage{ public: void readImage(char* data); void setRows(int row){ rows = row;

C++ header files

My header file looks like this:

#ifndef PPMIMAGE_H_ #define PPMIMAGE_H_ class PpmImage{ public: void readImage(char* data); void setRows(int row){ rows = row; } void setCols(int col){ cols = col; } void setDataArray(int size){ data = new char[size]; } int getRows(){ return rows; } int getCols(){ return cols; } char* getDataArray(){ return data; }

private: int rows; int cols; char* data; }; #endif

Now, I need to implement readImage() function in my .cpp file which now only contains the main method:

#include "ppmImage.h"

using namespace std;

int main(int argc, char** argv) {

PpmImage image; image.setRows(-1); image.setCols(-1); int rows = image.getRows(); int cols = image .getCols();

}

how to implement the readImage() function in my .cpp?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transact SQL Cookbook Help For Database Programmers

Authors: Ales Spetic, Jonathan Gennick

1st Edition

1565927567, 978-1565927568

More Books

Students also viewed these Databases questions