0% found this document useful (0 votes)
170 views2 pages

Program 7: Inheritance: Class Name Member Data Methods String Setcusname (String Cname)

The document describes a C++ program that uses inheritance between three classes - PrimaryInfo, SecondaryInfo, and Customer - to store customer data for an e-commerce company. PrimaryInfo and SecondaryInfo store basic customer information and are inherited by the Customer class. The main() function creates a Customer object and demonstrates accessing methods from all three classes to set and retrieve customer data.

Uploaded by

ewqdnweinfwr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
170 views2 pages

Program 7: Inheritance: Class Name Member Data Methods String Setcusname (String Cname)

The document describes a C++ program that uses inheritance between three classes - PrimaryInfo, SecondaryInfo, and Customer - to store customer data for an e-commerce company. PrimaryInfo and SecondaryInfo store basic customer information and are inherited by the Customer class. The main() function creates a Customer object and demonstrates accessing methods from all three classes to set and retrieve customer data.

Uploaded by

ewqdnweinfwr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Program 7: Inheritance

“Amazing Toys” a well reputed e-commerce company holds information of its


customers into two separate classes named as PrimaryInfo and SecondaryInfo.
Both classes are inherited by a class named as Customer. The member data of
each class named above are protected and the methods are public. Table below
shows the detail about member data and methods.
Class Name Member data Methods
PrimaryInfo string cusName; string setCusName(string cName)
string cusId; {
//The method will set customer’s name.
}
string setCusID(string cId)
{
//The method will set customer’s ID.
}
void showPrimaryInfo()
{
//The method will show customer’s primary
information.
//Use cout to show information.
}
SecondaryInfo string cusDoB; string setCusDateOfBirth(string date)
string cusAddress; {
//The method will set customer’s date of
birth.
}
string setCusAddress(string address)
{
//The method will set customer’s address.
}
void showSecondaryInfo()
{
//The method will show customer’s
secondary information.
//Use cout to show information.
}
Customer double cusIncome; double setCusIncome(double income)
char cusRating; {
//The method will set customer’s income.
}

char setCusRating(char rating)


{
//The method will set customer’s rating.

}
void showCusInfo()
{
//The method will show customer’s
information.
//Use cout to show information.
}

Write a program to demonstrate inheritance in C++ using the classes mentioned


above. You must write the main (). In the main(), create an object named as
customer with a reference to Customer and access all the methods shown in the
table above.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy