- 2

As a user creates a post, the text "New post" should be automatically outputted so that then the user can add the text he/she wa

Please use c

25th Jan 2021, 5:52 AM
sumit kumar
sumit kumar - avatar
3 odpowiedzi
0
using System; using System.Collections.Generic; namespace Code_Coach_Challenge { class Program { 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"); } //write a constructor here public void ShowPost() { Console.WriteLine(text); } public string text {get { return text;} set { text = value;} } //write a property for member text } }
26th Jan 2021, 1:39 AM
sumit kumar
sumit kumar - avatar
0
What's wrong in this code
26th Jan 2021, 1:40 AM
sumit kumar
sumit kumar - avatar
0
Hi. Watch out with upper cases in your code: public string Text so that part should be like this: public string Text { get { return text;} set { text = value;} } //write a property for member text Hope this helps
30th Jan 2021, 4:15 PM
Yuriy
Yuriy - avatar