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.

Recommended Answers

All 5 Replies

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?

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?

can you help?. i know some coding

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 more than is really called for sometimes; but **you **need to show some initiative first. Post whatever code you have for this (using CODE tags, please), and we can give you advice on it.

it's a relatively simple program if you somewhat know your way around classes .. im in a 12th grade programming class and i know a lot of ppl have trouble with this .. maybe you should look at your notes and use the examples given to create some basic but wrong code .. first try making the classes with the private, public and constructors

can you help?. i know some coding

Show us what you know... We'll help you from there..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.