/ConstMutableTest02.cpp Secret
Created
July 11, 2023 14:27
sub class const
This file contains hidden or 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> | |
class Aa { | |
public: | |
virtual void printTest() const = 0; | |
void printTest2() const { | |
printTest(); | |
std::cout << "Test 2" << std::endl; | |
} | |
}; | |
class Bb : public Aa { | |
public: | |
virtual void printTest() const { | |
std::cout << "Test" << std::endl; | |
} | |
}; | |
int main() { | |
Bb b = Bb(); | |
b.printTest2(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment