Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8319895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T22:28:07+00:00 2026-06-08T22:28:07+00:00

I am trying to create chained constructors but well, im no good at it

  • 0

I am trying to create chained constructors but well, im no good at it and need some help!
I get an message in one of the constructor telling me there are no constructors that takes two arguments. ?

What does it mean by that? I need it to handle 3 strings sent from another class and that leads me into the second question and that is i cant call this from my other class…i have tried everything and i just cant get it to do it 🙁 I feel there is something big i am missing about constructors but i am sure that someone can point me in the right way!! Please i can use any and all help here!!! I have read my C# books on this subject and they arent much help and i have googles and well there are many examples but none really makes much sense to me as i thought my code would work.

Here is my class i have the constructors i need to send variables to.

  public class Phone
  {
    //Private Phone
    private string m_persPhone;
    //Other Phone
    private string m_otherPhone;
    //Work Phone
    private string m_privatePhone;


    public Phone()            
    {
    }

    public Phone(string personalPhone)
        : this(personalPhone, string.Empty)     //<---Problem is HERE...
    {
    }    

    public Phone(string personalPhone, string otherPhone, string privatePhone)
    {
         m_persPhone = personalPhone;
         m_otherPhone = otherPhone;
         m_privatePhone = privatePhone;
    }

    public string personalPhone
    {
        //Personal Phone
        get { return m_persPhone; }

        set { m_persPhone = value; }
    }

    public string otherPhone
    {
        //Other Phone
        get { return m_otherPhone; }

        set { m_otherPhone = value; }
    }

    public string privatePhone
    {
        //Private Phone
        get { return m_privatePhone; }

        set { m_privatePhone = value; }
    }

    public string GetToStringItemsHeadings
    {
        get { return string.Format("{0,-20} {1, -20} {2, -20}", "Personal Phone", "Other Phone", "Private Phone"); }
    }

    public override string ToString()
    {
        string strOutPhone = string.Format("{0,-20} {1, -20} {2, -20}", m_persPhone, m_otherPhone, m_privatePhone);
        return strOutPhone;
    }


}

}

//Regards

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T22:28:09+00:00Added an answer on June 8, 2026 at 10:28 pm

    This code:

    public Phone(string personalPhone)
        : this(personalPhone, string.Empty)
    

    is looking for a constructor that takes two string arguments.

    The portion of the code

    this(personalPhone, string.Empty)
    

    means “Look for a constructor for this same class that takes the two arguments in my argument list (in this case, two strings) and then invoke that constructor”.

    However, you don’t define one. You could use the one that takes three string argument instead like this:

    public Phone(string personalPhone)
        : this(personalPhone, string.Empty, string.Empty)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to create a new Dedicated Cache Role in Windows Azure but get the
I'm trying create a RCP Application with Eclipse, but I can't get past the
I am trying create my custom Style spinner with help of this site. But
I am trying create a delegate representation of constructor by emitting a Dynamic Method,
Trying to create a black line in my view to separate text blocks but
I'm trying create a ASMX webservice that can perform a HTTP GET request. I
I'm trying create a new file with a Java Applet, but I don't know
I know there are lots of solutions for chained dropdown lists but i'm trying
I am trying to create a framework in Java which would support chained/pipelined queries
I'm trying create a gantt chart with highcharts and I need to put the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.