Using non-literal strings in different methods in C#

Fine, here you go. Passing the textbox values as arguments in the parameter. public sealed partial class MainPage : Page { public MainPage() { this.InitializeComponent(); txtName.Text = “Your name”; tbxAge.Text = “Your age”; tbxDinner.Text = “Your dinner”; OutputNewValues(txtName.Text, tbxAge.Text, tbxDinner.Text); } private void OutputNewValues(string name, string age, string dinner) { string answer = “Hello, ” … Read more

Use of Private static

ans is defined within the do{ … } while() loop but it must be defined outside, to make it available for condition in the while. So do: char ans = 0; do { Calc op = new Calc(); Scanner scan = new Scanner(System.in); ans = 0;

Private class property visible

Because you are using a copy constructor 😉 More seriously: private variables have class level visibility; your other object is a different instance, but it is of the same class; it is therefore granted that instance members of this object will be visible from the constructor. Note the “class level”. It means instance variables from … Read more