-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
57 additions
and
4 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#include <iostream> | ||
|
||
using namespace std; | ||
|
||
class FirstClass { | ||
public: | ||
void print1() { | ||
cout << "FirstClass::print1()" << endl; | ||
} | ||
virtual void print2() { | ||
cout << "FirstClass::print2()" << endl; | ||
} | ||
void print3() { | ||
print1(); | ||
print2(); | ||
cout << endl; | ||
} | ||
}; | ||
|
||
class SecondClass : public FirstClass { | ||
public: | ||
void print1() { | ||
cout << "SecondClass::print1()" << endl; | ||
} | ||
virtual void print2() { | ||
cout << "SecondClass::print2()" << endl; | ||
} | ||
}; | ||
|
||
class ThirdClass : public SecondClass { | ||
public: | ||
void print1() { | ||
cout << "ThirdClass::print1()" << endl; | ||
} | ||
virtual void print2() { | ||
cout << "ThirdClass::print2()" << endl; | ||
} | ||
}; | ||
|
||
int main(int argc, char **argv) { | ||
FirstClass f1; | ||
f1.print1(); | ||
f1.print2(); | ||
f1.print3(); | ||
|
||
SecondClass f2; | ||
f2.print1(); | ||
f2.print2(); | ||
f2.print3(); | ||
|
||
ThirdClass f3; | ||
f3.print1(); | ||
f3.print2(); | ||
f3.print3(); | ||
|
||
return 0; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,7 +99,3 @@ class IntSetList : public IntSet { | |
Node *first; | ||
}; | ||
|
||
|
||
|
||
|
||
|