Reputation: 6557
I have a parent class with some imported methods like this:
class Parent
{
[DllImport("user32.dll")]
public static extern IntPtr GetForegroundWindow();
}
Then I have another class that inherits from this Parent class
class Child : Parent
{
GetForegroundWindow(); // intellisense cannot find it
}
Does that mean I have to create a wrapper method around the imported GetForegroundWindow() method in the parent class in order to inherit and use it in the child class?
Upvotes: 0
Views: 148
Reputation: 43311
Place GetForegroundWindow call inside of some class method, and not directly in the class.
class Child : Parent { void Foo() { GetForegroundWindow(); } }
Upvotes: 2