Need help understanding some code (parameters)

Joined
May 26, 2019
Messages
1
Programming Experience
Beginner
C#:
class Member
    {
        public Member()
        {
            Console.WriteLine("Parent Constructor with no parameter");
        }

        public Member(string pName, int pMemberID, int pMemberSince)
        {
            Console.WriteLine("Parent Constructor with 3 parameters");

            name = pName;
            memberID = pMemberID;
            memberSince = pMemberSince;
        }

        protected int annualFee; //protected classes are a access modifer that can only be accessed through this class and classes that derive from it
        private string name;
        private int memberID;
        private int memberSince;

        public override string ToString()
        {
            return "\nName: " + name + "\nMember ID: " + memberID + "\nMember since: " + memberSince + "\nAnnual fee:" + annualFee;
        }

        public void CalculateAnnualFee()
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Here's the entire class but the focus is only on this part:

C#:
  public Member(string pName, int pMemberID, int pMemberSince)
        {
            Console.WriteLine("Parent Constructor with 3 parameters");

            name = pName;
            memberID = pMemberID;
            memberSince = pMemberSince;
        }
        {
            annualFee = 0;
        }
    }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
I just can't seem to wrap my head around how this function works with the class? If that makes sense? It's really everything about this that I don't seem to get so this isn't very specific, sorry.
 
Last edited by a moderator:
Did you acquire this code from MSDN Forums? If you wrote the code yourself, you'd surely know how it works and what it is doing. Can you explain a little as to what it is that you don't understand?
 
Back
Top Bottom