Program that uses auto-implemented properties, overriding ToString(), and a child class
Hello guys. I'm going to try to be as clear as possible, but bear with me.
I need to make a program that:
1. Create a class named LetterDemo that instantiates objects of two classes (named Letter and Certified Letter)
2. The Letter class includes auto-implemented properties for name of the letter recipient and the date is was mailed.
3. In the Letter class, also create a ToString() method that overrides the Object class's ToString() method and retuns a string that contains the name of the class (using GetType() and the Letter's data field values.
4. Create a child class named CertifiedLetter that contains an auto-implemented property that holds a tracking number for the letter. (I am assuming this would be given if the user indicates that the letter is certified.)
I have the layout figured out, but I am getting really lost in the sauce with how the classes and objects need to interact with each other.
Any help with at least a starting point or how to set up the objects and child class would be a life saver. I know I am probably overcomplicating this in my head. Thank you!
1 Reply
First things first, should
DateMailed
really be a string
, and not a DateTimeOffset
or DateOnly
? 🙂
Other than that, you're pretty close. The certified letter doesnt have a property to store its tracking number however
and you didnt actually override the ToString
method in either letter