I have to do a programming excercise for university.
I've done most of it, but I get some error and I can't figure out what's
wrong and how to solve it.
I hope you can understand it, because as I said it's for university and
that's why I have to do it in my native language.
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
using namespace std;
class Rechthoek{
protected:
int hoogte;
int breedte;
public:
Rechthoek(int hoogte, int breedte)
:hoogte(hoogte), breedte(breedte){
}
void print()
{
for(int i = 0; i < hoogte; i++){
for(int j = 0; j < breedte; j++)
cout << "* ";
cout << endl;
}
cout << endl;
}
};
class FlexRechthoek : virtual public Rechthoek{
public:
FlexRechthoek(int hoogte, int breedte)
:Rechthoek(hoogte, breedte){
}
void hoger()
{
hoogte++;
}
void breder()
{
breedte++;
}
};
class Venster : virtual public Rechthoek{
public:
Venster(int h, int b)
:Rechthoek(hoogte, breedte){
}
void print()
{
for(int i = 0; i < breedte; i++) //bovenstuk
cout << "* ";
cout << endl;
for(int j = 0; j < hoogte - 2; j++){ //middenstuk
cout << "* ";
for(int i = 0; i < breedte -2; i++)
cout << " ";
cout << "* " << endl;
}
for(int i = 0; i < breedte; i++) //eindstuk
cout << "* ";
cout << endl;
}
};
class VensterMetTitel : public Venster{
protected:
string titel;
public:
VensterMetTitel(int h, int b, string titel)
:Venster(hoogte, breedte), titel(titel){
}
void print()
{
for(int i = 0; i < breedte; i++) //bovenstuk
cout << "* ";
cout << endl;
for(int j = 0; j < hoogte - 2; j++){ //middenstuk
cout << "* ";
for(int i = 0; i < breedte -2; i++)
cout << " ";
cout << "* " << endl;
}
for(int i = 0; i < breedte; i++) //eindstuk
cout << "* ";
cout << endl;
}
};
int main()
{
Venster v1(5,9, "TEST");
v1.print();
}
I get the following error message: