please help me using C++ to create the following hierarchy of classes;
(1). a Person class with fields for name (type String) and an email address (type String). it should contain two constructors: one without input , a second one with input name of type string and email of type string to appropriately set the name and email address' you also need to provide a setName, setEmail and showPerson method.
(2). a OfficePerson class that extends Person. it should inherit the fields from Person well as define one additional field phone of type int to hold a 4-digit phone extension number. Override inherited methods only when necessary.
(3). a Test class that tests the two Person and OfficePerson classes by initiating appropriate objects.
Jump to Post
What do you need help with? What have you been able to do so far? Do you know the syntax for declaring classes, for inheritance, for invoking a method, etc?
Jump to Post
can you help?. i know some coding
Certainly I can help, as can several others here. However, writing the code for you would not be Help, it would be Cheating. No one here will help you do that.
We are willing to do quite a bit here, perhaps …
All 5 Replies
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.