Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary virtual from inheritance example #104

Merged
merged 1 commit into from
Sep 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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