All pastes #1893996 Raw Edit

virtuelle Basisklasse

public cpp v1 · immutable
#1893996 ·published 2010-07-03 17:58 UTC
rendered paste body
#include <iostream>using namespace std;class Fahrzeug{  public:   Fahrzeug (char * klasse)   {     cout << "Fahrzeug gerufen von " << klasse << endl;   }};class Auto :virtual public Fahrzeug{  public:    Auto()    :Fahrzeug("Auto")    {      cout << "Auto" << endl;    }};class Boot :virtual public Fahrzeug{  public:    Boot()    :Fahrzeug("Boot")    {      cout << "Boot" << endl;    }};class Amphibienfahrzeug :public Auto, Boot{  public:    Amphibienfahrzeug()    :Fahrzeug("Amphibienfahrzeug")    {      cout << "Amphibienfahrzeug" << endl;    }};class Supergefaehrt :public Amphibienfahrzeug{  public:    Supergefaehrt()    :Fahrzeug("Supergefaehrt")    {      cout << "Supergefaehrt" << endl;    }};int main(){  Fahrzeug f("Benutzer");  Auto a;  Boot b;  Amphibienfahrzeug af;  Supergefaehrt s;}