Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp2
- {
- class Student
- {
- static void Main(string[] args)
- { }
- private string myName = "N/A";
- private int myAge = 0;
- public string Name
- {
- get
- {
- return myName;
- }
- set
- {
- myName = value;
- }
- }
- public int Age
- {
- get
- {
- return myAge;
- }
- set
- {
- myAge = value;
- }
- }
- public override string ToString()
- {
- return "Name = " + Name + ", Age = " + Age;
- }
- public static void Main()
- {
- Student Student = new Student();
- Console.WriteLine("Student details - {0}",Student);
- Student.Name = "BOB";
- Student.Age = 99;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement