Question: C++ help. Directions: Create abstract classes to inherit, show polymorphic behavior and operator overloading. I have provided the .h and main.cpp files. Complete by writing
C++ help. Directions:
Create abstract classes to inherit, show polymorphic behavior and operator overloading. I have provided the .h and main.cpp files. Complete by writing the .cpp class files.
Output example should look like:

AbsRow.h:
#ifndef ABSROW_H
#define ABSROW_H
class AbsRow{
protected:
int size;
int *rowData;
public:
virtual int getSize()const = 0;
virtual int getData(int)const = 0;
};
#endif /* ABSROW_H */
AbsTabl.h:
#ifndef ABSTABL_H
#define ABSTABL_H
#include "RowAray.h"
class AbsTabl{
protected:
int szRow;
int szCol;
RowAray **columns;
public:
virtual int getSzRow()const = 0;
virtual int getSzCol()const = 0;
virtual int getData(int,int)const = 0;
};
#endif /* ABSTABL_H */
PlusTab.h:
#ifndef PLUSTAB_H
#define PLUSTAB_H
#include "Table.h"
class PlusTab:public Table{
public:
PlusTab(unsigned int r,unsigned int c):Table(r,c){};
PlusTab operator+(const PlusTab &);
};
#endif /* PLUSTAB_H */
RowAray.h:
#ifndef ROWARAY_H
#define ROWARAY_H
#include "AbsRow.h"
class RowAray:public AbsRow{
public:
RowAray(unsigned int);
virtual ~RowAray();
int getSize()const{return size;}
int getData(int i)const{
if(i>=0&&i else return 0;} void setData(int,int); }; #endif /* ROWARAY_H */ Table.h: #ifndef TABLE_H #define TABLE_H #include "AbsTabl.h" class Table:public AbsTabl{ public: Table(unsigned int,unsigned int); Table(const Table &); virtual ~Table(); int getSzRow()const {return szRow;} int getSzCol()const {return szCol;} int getData(int,int)const; void setData(int,int,int); }; #endif /* TABLE_H */ main.cpp: #include //User Libraries #include "PlusTab.h" //Global Constants //Function Prototype void prntTab(const Table &); //Execution Begins Here! int main(int argc, char** argv) { //Initialize the random seed srand(static_cast //Exit Stage Right return 0; } void prntTab(const Table &a){ cout Abstracted and Polymorphic Print Table 1 size is [row, col]-[3,4] 87 92 81 44 16 72 54 39 32 62 8669 Copy Constructed Table 2 size is [row, col]- [3,4] 87 92 81 44 16 72 54 39 32 62 86 69 Operator Overloaded Table 3 size is [row, col] - [3,4 174 184 162 88 2 144 108 78 64 124 172 138 RUN SUCCESSFUL (total time: 873ms) Abstracted and Polymorphic Print Table 1 size is [row, col]-[3,4] 87 92 81 44 16 72 54 39 32 62 8669 Copy Constructed Table 2 size is [row, col]- [3,4] 87 92 81 44 16 72 54 39 32 62 86 69 Operator Overloaded Table 3 size is [row, col] - [3,4 174 184 162 88 2 144 108 78 64 124 172 138 RUN SUCCESSFUL (total time: 873ms)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
