using System;
using static System.Console;
using System.Globalization;
using System.Reflection.Metadata.Ecma335;
/*
Create an application class named LetterDemo that instantiates objects of two classes named Letter and CertifiedLetter and that demonstrates all their methods.
The classes are used by a company to keep track of letters they mail to clients. The Letter class includes auto-implemented properties for the Name of the recipient and the Date mailed (stored as strings).
Create a child class named CertifiedLetter that includes an auto-implemented property TrackingNumber (of type string) that holds a tracking number for the letter.
Next, include a ToString() method that overrides the Object class’s ToString() method and returns a string that contains the name of the class (using GetType()) and the respective class's data field values. Use default, empty constructor for both classes.
*/
class LetterDemo
{
static void Main()
{
// Write your code here
Letter letterObject = new Letter();
Letter CertifiedLetter = new CertifiedLetter();
}
public class Letter()
{
private string Name;
private string Date;
public string Name { get; set; }
public string Date { get; set; }
}
public class CertifiedLetter : Letter
{
private string TrackingNumber;
public string TrackingNumber { get; set; }
}
public override string ToString()
{
string className = WriteLine(Letter.GetType());
return className;
}
}
using System;
using static System.Console;
using System.Globalization;
using System.Reflection.Metadata.Ecma335;
/*
Create an application class named LetterDemo that instantiates objects of two classes named Letter and CertifiedLetter and that demonstrates all their methods.
The classes are used by a company to keep track of letters they mail to clients. The Letter class includes auto-implemented properties for the Name of the recipient and the Date mailed (stored as strings).
Create a child class named CertifiedLetter that includes an auto-implemented property TrackingNumber (of type string) that holds a tracking number for the letter.
Next, include a ToString() method that overrides the Object class’s ToString() method and returns a string that contains the name of the class (using GetType()) and the respective class's data field values. Use default, empty constructor for both classes.
*/
class LetterDemo
{
static void Main()
{
// Write your code here
Letter letterObject = new Letter();
Letter CertifiedLetter = new CertifiedLetter();
}
public class Letter()
{
private string Name;
private string Date;
public string Name { get; set; }
public string Date { get; set; }
}
public class CertifiedLetter : Letter
{
private string TrackingNumber;
public string TrackingNumber { get; set; }
}
public override string ToString()
{
string className = WriteLine(Letter.GetType());
return className;
}
}