TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
netgesid
NA
3
0
Destructing an object
Jul 19 2004 3:29 AM
Hi, I have this main "test" code, { Firm f = new Firm(0.3f); Consumer c = new Consumer(1,f); Console.WriteLine("First Test {0}",(c.isNull() ? "FAIL" : "OK")); f = null; GC.Collect(); GC.WaitForPendingFinalizers(); Console.WriteLine("Second Test {0}",(c.isNull() ? "OK" : "FAIL")); } The Consumer constructor do this... public Consumer(int pId, Firm pFirm) { Id = pId; myFirm = new Firm(0f); myFirm = pFirm; } where myFirm is defined as "private Firm myFirm;" and the isNull() method is like this, public bool isNull() { return (myFirm==null); } When I run the test... y obtain, First Test OK Second Test FAIL Can anyone explain to me why the second test Fail? I understand (well I think so) that the object "f" is passed to the constructor by reference. Thanks in advance!!!!
Reply
Answers (
3
)
Toolbar alignment in VB .NET
got problem opening Excel from VB.net