+ 1

I need some help, what is wrong here?

static void Main(string[] args) { string postText = Console.ReadLine(); Post post = new Post(); post.Text = postText; post.ShowPost(); } } class Post { private string text; public post() { Console.WriteLine("New post"); } public void ShowPost() { Console.WriteLine(text); } public string Text { get { return text; } set { text = value; } } } }

16th Apr 2022, 5:59 PM
Chuy Chuy
Chuy Chuy - avatar
2 Answers
0
Constructor name should be same as class name.. use Capital P in post() public Post() { Console.WriteLine("New post"); }
16th Apr 2022, 7:28 PM
Jayakrishna 🇼🇳
+ 1
ÂĄThank you!
16th Apr 2022, 8:01 PM
Chuy Chuy
Chuy Chuy - avatar