Skip to content

Commit

Permalink
Remove unnecessary virtual from inheritance example (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
niosus authored Sep 14, 2024
1 parent 5b58707 commit 10c44a0
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lectures/inheritance.md
Original file line number Diff line number Diff line change
Expand Up @@ -917,6 +917,9 @@ $PLACEHOLDER
#include <iostream>
#include <vector>
// Can be any custom type
using Color = int;
struct Noncopyable {
Noncopyable() = default;
Noncopyable(const Noncopyable&) = delete;
Expand All @@ -938,8 +941,8 @@ struct JpegIo final : public IoInterface {
std::cout << "Reading JPEG from path: " << path << std::endl;
return {};
}
virtual void Write(const std::filesystem::path& path,
const std::vector<Color>& data) const override {
void Write(const std::filesystem::path& path,
const std::vector<Color>& data) const override {
std::cout << "Writing JPEG to path: " << path << std::endl;
}
};
Expand All @@ -949,8 +952,8 @@ struct PngIo final : public IoInterface {
std::cout << "Reading PNG from path: " << path << std::endl;
return {};
}
virtual void Write(const std::filesystem::path& path,
const std::vector<Color>& data) const override {
void Write(const std::filesystem::path& path,
const std::vector<Color>& data) const override {
std::cout << "Writing PNG to path: " << path << std::endl;
}
};
Expand Down

0 comments on commit 10c44a0

Please sign in to comment.