Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / May 2004

Tip: Looking for answers? Try searching our database.

Maybe faulty use of inheritance / composistion?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Flare - 19 May 2004 18:21 GMT
Hi I have this..

class BaseUnit;
...
class ResizeBorder : Shape
...

class Shape : BaseUnit
{
   ResizeBorder a = new ResizeBorder();
}

(The classes offcourse has implementations)

When i do this i get a stackOverFlowException.

If ResizeBorder dosent inherit from shape it works perfeckt...Am I doing
someth?ng wrong? Or is the StackOverFlow maybe caused ba something else wich
first shows when i use the above form?

Anders
Bruno Jouhier [MVP] - 19 May 2004 18:33 GMT
a shape has a resize border (you allocate one in the constructor)
   a resize border is a shape (by inheritance)
       so a resize border has a resize border
           the resize border of a resize border is a shape
               so the resize border of a resize border has a resize border
                   ...
Bruno.

> Hi I have this..
>
[quoted text clipped - 17 lines]
>
> Anders
Alvin Bruney [MVP] - 19 May 2004 19:24 GMT
hmmm,
beware the dangers of inheritance

Signature

Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok

>a shape has a resize border (you allocate one in the constructor)
>    a resize border is a shape (by inheritance)
[quoted text clipped - 26 lines]
>>
>> Anders

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.