title: Construction looping through object creation
body: <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  
  namespace CodyGarrettEX3
  {
      public class Account
      {
          private long acctNumber;
          protected double balance;
          public Savings SavingsAccount;
          public Checking CheckingAccount;
  
          public Account()
          {
              this.acctNumber = 1234;
              Savings SavingsAccount = new Savings(acctNumber);
              Checking CheckingAccount = new Checking(acctNumber);
          }
  
          public Account(long newAcctNo)
          {
              this.acctNumber = newAcctNo;
              Savings SavingsAccount = new Savings(newAcctNo);
              Checking CheckingAccount = new Checking(newAcctNo);
          }
  
          //Members
          public long AcctNo
          {
              get { return AcctNo; }
              set { AcctNo = value; }
          }
  
          public double Balance
          {
              get { return balance; }
              set { balance = value; }
          }
  
          public virtual double Withdrawal(double amount)
          {
              if ((balance - amount) &lt; 0)
              {
                  PolicyException insufficientFundsException = new PolicyException("Insufficient Funds To Complete This Transaction");
                  throw insufficientFundsException;
              }
  
              return balance;
          }
  
          public double Deposit(double amount)
          {
              balance = balance + amount;
              return balance;
          }
  
      }
  }
  
  
  
  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  
  namespace CodyGarrettEX3
  {
      public class Savings: Account
      {
          private double interestRate;
          private double minBalance;
  
          public Savings(long newAcctNumber):base(newAcctNumber)
          {
              balance = 0;
              interestRate = 0;
              minBalance = 0;
          }
  
          //Properties
          public double InterestRate //This is a correctional to ensure that the interest rate is always stored as a decimal for math calculations
          {
              get { return interestRate; }
              set 
              { 
                  if (value &gt; 0)
                  {
                      value = value / 100;
                  }
                  interestRate = value;
              }
          }
  
          public double MinBalance
          {
              get { return minBalance; }
              set { minBalance = value; }
          }
  
          public override double Withdrawal(double amount)
          {
              if (minBalance &gt; 0)
              {
                  if (amount &gt; (balance - minBalance))
                  {
                      PolicyException minBalanceException = new PolicyException("Insufficient Funds to Complete This Transaction, Exceeds Account Balance and Minimum Balance of Account");
                      throw minBalanceException;
                  }
              }
              else
              {
                  if(amount &gt; (balance - amount))
                  {
                      PolicyException insufficientFundsException = new PolicyException("Insufficient Funds to Complete This Transaction, Exceeds Account Balance");
                      throw insufficientFundsException;
                  }
              }
              return balance;
          }
  
      }
  }
  </code></pre>
  
  <p>The main issue as it would seem is that upon compilation of the class that manipulates my parent Which is the Account Class is that I get a really odd loop that just goes from the Account Constructor to the Savings Constructor rapidly and then causes a stack overflow.</p>
  
  <p>This happens after the execution of "Account BankAccount = new Account(9999);" in my program testing class.</p>
  
  <p>Thank you so much for your help everyone! I'm really struggling to figure out what is the cause here.</p>
  
  <p>Also, side note I have the constructor built that way due to a requirement in an assignment that mandates we have to have the acctNumber variable pass into the object before it can be created. Even if the object doesn't use the value. However, if this is not possible I am open to anything really.</p>