05_OOb: Testat bestanden

This commit is contained in:
Johannes Theiner 2018-11-13 10:56:02 +01:00
parent 745ab41c9d
commit 6e406b3832

View File

@ -153,26 +153,50 @@ bool HeapObject::assertionsHold(){
}
class K : public HeapObject
{
class K : public HeapObject {
private:
A a;
public:
K(){std::cout << "+K ";}
K(){std::cout << "+K ";}
~K(){std::cout << "-K ";}
};
class L {
class K2 : public HeapObject {
private:
A a;
public:
L(){std::cout << "+L ";}
~L(){std::cout << "-L ";}
K2(){
B b;
std::cout << "+K ";}
~K2(){std::cout << "-K ";}
};
class M {
class M : public K{
public:
M(){std::cout << "+M ";}
M(){
{
B b;
}
std::cout << "+M ";
}
~M(){std::cout << "-M ";}
};
class L : public M{
public:
L(){std::cout << "+L ";}
~L(){std::cout << "-L ";}
};
void mod5() {
L *p = new L();
delete p;
}
void testat() {
K2 k2;
}
int main(int argc, const char * argv[]) {
@ -191,6 +215,10 @@ int main(int argc, const char * argv[]) {
HeapObject::assertionsHold();
std::cout << " ENDE" << std::endl;
mod5();
std::cout << std::endl;
testat();
return 0;
}