Thread: Problem inheriting class getting infinite loop

  1. #1
    Registered User
    Join Date
    Dec 2010
    Posts
    2

    Problem inheriting class getting infinite loop

    My main class has a Property in it that i need to access in my sub class.
    But every time i try to inherit the main class i get a error from where its infinite loop.

    Main Class:
    C# | using System; using System.Collections.Generic; - Main class

    Sub Class:
    C# | using System.Diagnostics; using Microsoft.Xna.Fra - Sub Class

  2. #2
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    I don't see any inheritance going on, if it were, your property would probably need to be virtual. What is your exact error message and what line is it on?
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  3. #3
    Registered User
    Join Date
    Dec 2010
    Posts
    2
    An unhandled exception of type 'System.StackOverflowException' occurred in Project - Pro Racer.exe Line 17 in Engine.cs

    updated code with inherit and virtual.

    Main
    C# | using System; using System.Collections.Generic; - Main Class

    Sub
    C# | using System.Diagnostics; using Microsoft.Xna.Fra - Sub Class
    Last edited by joeba18; 12-14-2010 at 01:14 PM.

  4. #4
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    That usually means you have a recursive infinite loop. After looking at the code I think you will need to show us more pieces of it for us to help you. Line 17 makes no sense in either file unless some object you are passing as a param is causing the issue.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. problem in pass a variable to a class
    By nima_pw in forum C# Programming
    Replies: 3
    Last Post: 06-09-2009, 07:30 AM
  2. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  3. Message class ** Need help befor 12am tonight**
    By TransformedBG in forum C++ Programming
    Replies: 1
    Last Post: 11-29-2006, 11:03 PM
  4. Infinite loop problem
    By Xanth in forum C++ Programming
    Replies: 2
    Last Post: 02-20-2005, 12:08 AM
  5. structure vs class
    By sana in forum C++ Programming
    Replies: 13
    Last Post: 12-02-2002, 07:18 AM