- 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
3 Respuestas
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
}
}
0
What's wrong in this code
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