• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 629
  • Last Modified:

What does mean to instantiate a class object during this same class initialization?

I'm looking at some code that a new class has a line of code instantiating it during its deiniting.  What's the purpose of this?  Is this the class contructor now?  Why does have that named as ParentInterest?  It usually just the same name as the class, isn't it?  I'm confused here.
Thanks.

    public class IInterest
    {
        public Interest ParentInterest { get; set; }
        public long Id { get; set; }
        public string Name { get; set; }
    }
0
lapucca
Asked:
lapucca
1 Solution
 
PlatoConsultantCommented:
 public class IInterest
    {
        public Interest ParentInterest { get; set; }
        public long Id { get; set; }
        public string Name { get; set; }
    }

Interest  and IInterest are seperate classes normally IInterst is used for intereface...

here but if both of them are same classes then the self referential relationship exisits between the two classes that a class contains a refrence to it self...


for example person is a class but person has parents and childs but all of them are persons also hence persons is store refrence to parents and childs which are the same class person...
 
0
 
lapuccaAuthor Commented:
Yes, they're both the same class.  I just had a type there.  
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now