Click here to Skip to main content
14,388,768 members
   

C#

 
Questionc# Pin
Member 1312071627-Jun-19 23:49
MemberMember 1312071627-Jun-19 23:49 
AnswerRe: c# Pin
OriginalGriff28-Jun-19 0:30
mveOriginalGriff28-Jun-19 0:30 
GeneralRe: c# Pin
Eddy Vluggen28-Jun-19 3:03
mveEddy Vluggen28-Jun-19 3:03 
GeneralRe: c# Pin
OriginalGriff28-Jun-19 3:23
mveOriginalGriff28-Jun-19 3:23 
GeneralRe: c# Pin
Eddy Vluggen28-Jun-19 3:39
mveEddy Vluggen28-Jun-19 3:39 
AnswerRe: c# Pin
Gerry Schmitz28-Jun-19 7:51
mveGerry Schmitz28-Jun-19 7:51 
QuestionBase toString not printing to console Pin
Member 1451443227-Jun-19 6:42
MemberMember 1451443227-Jun-19 6:42 
AnswerRe: Base toString not printing to console Pin
Dave Kreskowiak27-Jun-19 6:59
mveDave Kreskowiak27-Jun-19 6:59 
Get to know the debugger. It would easily help you out with this.
public string ToStirng()
        {
            return ("Name: " + getName()
                    +"\n"
                    +"Age: " + getAge()
                    +"\n"
                    +"Breed: " + getBreed()
                    +"\n"
                    +"Fur Color: " + getFurColor());
        }

Why do you have all these get and set methods? You could easily just replace them with properties:
public abstract class Animal
{
    public string Name { get; set; }
    public int Age { get; set; }
    public string Breed { get; set; }
    public string FurColor { get; set; }

    public Animal(string name, int age, string breed, string furColor)
    {
        Name = name;
        Age = age;
        Breed = breed;
        FurColor = furColor;
    }

    public abstract void Sound();

    public override string ToString()
    {
        return $"Name: {Name}\nAge: {Age}\nBreed: {Breed}\nFur Color: {FurColor}";
    }
}


GeneralRe: Base toString not printing to console Pin
Member 1451443227-Jun-19 7:14
MemberMember 1451443227-Jun-19 7:14 
AnswerRe: Base toString not printing to console Pin
OriginalGriff27-Jun-19 7:07
mveOriginalGriff27-Jun-19 7:07 
GeneralRe: Base toString not printing to console Pin
Member 1451443227-Jun-19 7:12
MemberMember 1451443227-Jun-19 7:12 
GeneralRe: Base toString not printing to console Pin
OriginalGriff27-Jun-19 7:24
mveOriginalGriff27-Jun-19 7:24 
QuestionNew to Coding New to Code Project Pin
Member 1451100824-Jun-19 11:11
MemberMember 1451100824-Jun-19 11:11 
AnswerRe: New to Coding New to Code Project Pin
Eddy Vluggen24-Jun-19 12:19
mveEddy Vluggen24-Jun-19 12:19 
GeneralRe: New to Coding New to Code Project Pin
Mycroft Holmes24-Jun-19 14:10
MemberMycroft Holmes24-Jun-19 14:10 
GeneralRe: New to Coding New to Code Project Pin
Eddy Vluggen24-Jun-19 14:27
mveEddy Vluggen24-Jun-19 14:27 
AnswerRe: New to Coding New to Code Project Pin
Mycroft Holmes24-Jun-19 14:11
MemberMycroft Holmes24-Jun-19 14:11 
AnswerRe: New to Coding New to Code Project Pin
Ger Hayden24-Jun-19 22:51
MemberGer Hayden24-Jun-19 22:51 
AnswerRe: New to Coding New to Code Project Pin
Richard MacCutchan24-Jun-19 23:24
mveRichard MacCutchan24-Jun-19 23:24 
AnswerRe: New to Coding New to Code Project Pin
#realJSOP26-Jun-19 7:32
mve#realJSOP26-Jun-19 7:32 
AnswerRe: New to Coding New to Code Project Pin
Gerry Schmitz26-Jun-19 9:53
mveGerry Schmitz26-Jun-19 9:53 
QuestionWhat is wrong with my code in Visual Studios Pin
Member 1451091724-Jun-19 8:46
MemberMember 1451091724-Jun-19 8:46 
AnswerRe: What is wrong with my code in Visual Studios Pin
Richard Deeming24-Jun-19 9:39
mveRichard Deeming24-Jun-19 9:39 
GeneralRe: What is wrong with my code in Visual Studios Pin
Member 1451091724-Jun-19 10:12
MemberMember 1451091724-Jun-19 10:12 
AnswerRe: What is wrong with my code in Visual Studios Pin
OriginalGriff24-Jun-19 20:56
mveOriginalGriff24-Jun-19 20:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.