+ 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; } } } }
2 Answers
0
Constructor name should be same as class name..
use Capital P in post()
public Post()
{
Console.WriteLine("New post");
}
+ 1
Ā”Thank you!