
Untitled
By: a guest on
Apr 28th, 2012 | syntax:
C++ | size: 0.93 KB | hits: 19 | expires: Never
#include <stdio.h>
#include <stdlib.h>
class A {
public:
virtual void saraza() = 0;
};
class B: public A {
public:
virtual void saraza() {
printf("saraza");
}
};
class C {
public:
void trulala(A unDato) {
a.saraza();
}
};
int main() {
B b();
C c();
c.trulala(b);
return 0;
}
/*
barbazul@barbazul ~/Organizacion de Datos/tpDatos/lib/File $ g++ test.cpp -o test
test.cpp:18:20: error: cannot declare parameter ‘unDato’ to be of abstract type ‘A’
test.cpp:4:7: note: because the following virtual functions are pure within ‘A’:
test.cpp:6:18: note: virtual void A::saraza()
test.cpp: In member function ‘void C::trulala(A)’:
test.cpp:19:9: error: ‘a’ was not declared in this scope
test.cpp: In function ‘int main()’:
test.cpp:27:7: error: request for member ‘trulala’ in ‘c’, which is of non-class type ‘C()’
*/