Skip to content

Why use virtual functions in derived classes? #590

@robwhess

Description

@robwhess

This is part question, part issue. I don't really understand the design decision to make functions in derived classes virtual. For example, each layer class derived from Layer has all of its functions (which override the ones in Layer) declared as virtual as well. Why are things done this way? Is the polymorphism here used anywhere beyond the initially derived classes themselves? I think there's typically a (very) slight effect on performance with virtual functions, so it might make sense to use virtual functions only when we know the polymorphism is going to be used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions