Is it possible to augment an external type without deriving from it? #7970
-
Like the title says, I would like to add some properties and methods to an external type that I can't modify directly. For example: class Foo
{
}
// <-- How can I specify here that Foo has some extra properties, without touching the main Foo declaration?
|
Beta Was this translation helpful? Give feedback.
Answered by
AndrolGenhald
May 14, 2022
Replies: 1 comment 1 reply
-
You can use stubs. Class declarations from stubs get merged with the actual declaration, so you don't need to repeat everything, just add what you need. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
rzvc
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can use stubs. Class declarations from stubs get merged with the actual declaration, so you don't need to repeat everything, just add what you need.