Reputation: 3843
I am trying to create object of login which is inherit from MainWindow(Default window created in c# code) Here is my code :
public partial class MainWindow : Window
{
login ins = new login();
.
.
.
.
}
public class login
{
public login(){}
}
Its giving error : An unhandled exception of type 'System.StackOverflowException' occurred
Upvotes: 0
Views: 92
Reputation: 61339
By deriving from MainWindow
you invoke the instructor of MainWindow
each time you instantiate login
.
Thus, your code does:
Your "Login" class shouldn't derive from "MainWindow" (and neither should anything else!)
Upvotes: 1