Home > Net >  C # a problem using the function
C # a problem using the function

Time:12-15

Create a ConsoleApp1 project
The Person class


Write properties and constructor, in the constructor call


F5 to run the console



Run the console is empty, why don't call the name parameter

CodePudding user response:

There is no output, the console is empty, of course, do you want to print the S1. The name?

CodePudding user response:

You didn't write down the console. Writeline ()

CodePudding user response:

This just instantiate the Person class, you did not call instance s1 the name attribute of the
The Console. Write (s1. Name);

CodePudding user response:

The second screenshot, line 10, please add: Console. Write (s1) Name);

CodePudding user response:

Thank you, I forget
  •  Tags:  
  • C#
  • Related