Created
April 26, 2018 07:15
-
-
Save emirozturk/6fa4ffb6b6b821bac05da23e738c097e to your computer and use it in GitHub Desktop.
Virtual Classes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
class temel { | |
public: | |
temel() { | |
cout << "temel" << endl; | |
} | |
~temel() { | |
cout << "temel yikici" << endl; | |
} | |
}; | |
class A : public virtual temel { | |
public: | |
A() { | |
cout << "A" << endl; | |
} | |
~A() { | |
cout << "A yikici" << endl; | |
} | |
void calis() { | |
cout << "temel calisti" << endl; | |
} | |
}; | |
class B : public virtual temel { | |
public: | |
B() { | |
cout << "B" << endl; | |
} | |
~B() { | |
cout << "B yikici" << endl; | |
} | |
void calis() { | |
cout << "temel calisti" << endl; | |
} | |
}; | |
class C : public B, public A { //Yer değiştirince değişir mi? | |
public: | |
C() { | |
cout << "C" << endl; | |
} | |
~C() { | |
cout << "C yikici" << endl; | |
} | |
}; | |
int main() | |
{ | |
C yeni; | |
yeni.calis(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment