SlideShare a Scribd company logo
1 of 2
Suppose a zoo wants a C++ program to keep track of its animals
and to provide information for visitors. Suppose the following
class is the base class of an public inheritance hierarchy.
class Animal
{
public:
Animal( string &nme );
private:
string name; // The particular animal’s name
};
Animal::Animal( string &nme ) : name( nme ) {}
Create a derived class that represents a specific group or family
of animals, and derive from that another class that represents an
even more specific family or an individual species. For
example, your classes could be
Bear
and
PolarBear
, or
Cat
and
Lion
. Each of your classes should publicly inherit from the next
larger class up the inheritance chain (e.g.
PolarBear
inherits from
Bear
and
Bear
inherits from
Animal.
) Each of your classes should contain a private
static
data member representing something that is true of all objects
of that class. (e.g. for
PolarBear
, it might be a Boolean
isWhite).
Post the C++ declaration of your two classes and show the
constructor code and the initialization of the static data
members.

More Related Content

More from calvins9

Supporting Developmentally Appropriate PracticesSupporting D.docx
Supporting Developmentally Appropriate PracticesSupporting D.docxSupporting Developmentally Appropriate PracticesSupporting D.docx
Supporting Developmentally Appropriate PracticesSupporting D.docx
calvins9
 
Supporting Developmentally Appropriate Practices.For this as.docx
Supporting Developmentally Appropriate Practices.For this as.docxSupporting Developmentally Appropriate Practices.For this as.docx
Supporting Developmentally Appropriate Practices.For this as.docx
calvins9
 
Supporting Developmentally Appropriate PracticesSupporting.docx
Supporting Developmentally Appropriate PracticesSupporting.docxSupporting Developmentally Appropriate PracticesSupporting.docx
Supporting Developmentally Appropriate PracticesSupporting.docx
calvins9
 
supporting docu-mentation.In 2005, the more than 70 agencies of .docx
supporting docu-mentation.In 2005, the more than 70 agencies of .docxsupporting docu-mentation.In 2005, the more than 70 agencies of .docx
supporting docu-mentation.In 2005, the more than 70 agencies of .docx
calvins9
 
Supply and Demand GuideTo solve the homework problems do the f.docx
Supply and Demand GuideTo solve the homework problems do the f.docxSupply and Demand GuideTo solve the homework problems do the f.docx
Supply and Demand GuideTo solve the homework problems do the f.docx
calvins9
 
Support or refute this statement [T]he Declaration functioned .docx
Support or refute this statement [T]he Declaration functioned .docxSupport or refute this statement [T]he Declaration functioned .docx
Support or refute this statement [T]he Declaration functioned .docx
calvins9
 
Support for Caregivers of Cancer Patient.docx
Support for Caregivers of Cancer Patient.docxSupport for Caregivers of Cancer Patient.docx
Support for Caregivers of Cancer Patient.docx
calvins9
 
SUPPLEMENTARY LOW SPEED AERODYNAMICS (DEN233) .docx
SUPPLEMENTARY   LOW SPEED AERODYNAMICS (DEN233)  .docxSUPPLEMENTARY   LOW SPEED AERODYNAMICS (DEN233)  .docx
SUPPLEMENTARY LOW SPEED AERODYNAMICS (DEN233) .docx
calvins9
 
Supply Market Analysis for a Competitive Advantage Davi.docx
Supply Market Analysis for a Competitive Advantage  Davi.docxSupply Market Analysis for a Competitive Advantage  Davi.docx
Supply Market Analysis for a Competitive Advantage Davi.docx
calvins9
 
Supply ChainManagementA LOGISTICS PERSPECTIVE9e.docx
Supply ChainManagementA LOGISTICS PERSPECTIVE9e.docxSupply ChainManagementA LOGISTICS PERSPECTIVE9e.docx
Supply ChainManagementA LOGISTICS PERSPECTIVE9e.docx
calvins9
 
Summative Productivity Lab Maxi Widjojo IB S1 ESS Mrs. .docx
Summative Productivity Lab Maxi Widjojo  IB S1 ESS Mrs. .docxSummative Productivity Lab Maxi Widjojo  IB S1 ESS Mrs. .docx
Summative Productivity Lab Maxi Widjojo IB S1 ESS Mrs. .docx
calvins9
 
Sun, sea, sand and tsunami examiningdisaster vulnerability .docx
Sun, sea, sand and tsunami examiningdisaster vulnerability .docxSun, sea, sand and tsunami examiningdisaster vulnerability .docx
Sun, sea, sand and tsunami examiningdisaster vulnerability .docx
calvins9
 
Summary 1271 Wordssecond hand smoke55SIMILARITY.docx
Summary 1271 Wordssecond hand smoke55SIMILARITY.docxSummary 1271 Wordssecond hand smoke55SIMILARITY.docx
Summary 1271 Wordssecond hand smoke55SIMILARITY.docx
calvins9
 
Superior Electrical (Superior) was in the business of installing ele.docx
Superior Electrical (Superior) was in the business of installing ele.docxSuperior Electrical (Superior) was in the business of installing ele.docx
Superior Electrical (Superior) was in the business of installing ele.docx
calvins9
 
Superstorm scenario–a so-called Superstorm” is predicted to affe.docx
Superstorm scenario–a so-called Superstorm” is predicted to affe.docxSuperstorm scenario–a so-called Superstorm” is predicted to affe.docx
Superstorm scenario–a so-called Superstorm” is predicted to affe.docx
calvins9
 
Supply Chain ManagementSTRATEGY, PLANNING, AND OPERATION.docx
Supply Chain ManagementSTRATEGY, PLANNING, AND OPERATION.docxSupply Chain ManagementSTRATEGY, PLANNING, AND OPERATION.docx
Supply Chain ManagementSTRATEGY, PLANNING, AND OPERATION.docx
calvins9
 

More from calvins9 (20)

Supporting Developmentally Appropriate PracticesSupporting D.docx
Supporting Developmentally Appropriate PracticesSupporting D.docxSupporting Developmentally Appropriate PracticesSupporting D.docx
Supporting Developmentally Appropriate PracticesSupporting D.docx
 
Supporting Developmentally Appropriate Practices.For this as.docx
Supporting Developmentally Appropriate Practices.For this as.docxSupporting Developmentally Appropriate Practices.For this as.docx
Supporting Developmentally Appropriate Practices.For this as.docx
 
Supporting Developmentally Appropriate PracticesSupporting.docx
Supporting Developmentally Appropriate PracticesSupporting.docxSupporting Developmentally Appropriate PracticesSupporting.docx
Supporting Developmentally Appropriate PracticesSupporting.docx
 
Supporting LecturesRefer to the following lectureNut.docx
Supporting LecturesRefer to the following lectureNut.docxSupporting LecturesRefer to the following lectureNut.docx
Supporting LecturesRefer to the following lectureNut.docx
 
supporting docu-mentation.In 2005, the more than 70 agencies of .docx
supporting docu-mentation.In 2005, the more than 70 agencies of .docxsupporting docu-mentation.In 2005, the more than 70 agencies of .docx
supporting docu-mentation.In 2005, the more than 70 agencies of .docx
 
Support or oppose the statement Young people do too much cell phon.docx
Support or oppose the statement Young people do too much cell phon.docxSupport or oppose the statement Young people do too much cell phon.docx
Support or oppose the statement Young people do too much cell phon.docx
 
Supply and Demand GuideTo solve the homework problems do the f.docx
Supply and Demand GuideTo solve the homework problems do the f.docxSupply and Demand GuideTo solve the homework problems do the f.docx
Supply and Demand GuideTo solve the homework problems do the f.docx
 
Support or refute this statement [T]he Declaration functioned .docx
Support or refute this statement [T]he Declaration functioned .docxSupport or refute this statement [T]he Declaration functioned .docx
Support or refute this statement [T]he Declaration functioned .docx
 
Support your argument for and against hospice. As well as furthe.docx
Support your argument for and against hospice. As well as furthe.docxSupport your argument for and against hospice. As well as furthe.docx
Support your argument for and against hospice. As well as furthe.docx
 
Support for Caregivers of Cancer Patient.docx
Support for Caregivers of Cancer Patient.docxSupport for Caregivers of Cancer Patient.docx
Support for Caregivers of Cancer Patient.docx
 
SUPPLEMENTARY LOW SPEED AERODYNAMICS (DEN233) .docx
SUPPLEMENTARY   LOW SPEED AERODYNAMICS (DEN233)  .docxSUPPLEMENTARY   LOW SPEED AERODYNAMICS (DEN233)  .docx
SUPPLEMENTARY LOW SPEED AERODYNAMICS (DEN233) .docx
 
Supply Market Analysis for a Competitive Advantage Davi.docx
Supply Market Analysis for a Competitive Advantage  Davi.docxSupply Market Analysis for a Competitive Advantage  Davi.docx
Supply Market Analysis for a Competitive Advantage Davi.docx
 
Supply ChainManagementA LOGISTICS PERSPECTIVE9e.docx
Supply ChainManagementA LOGISTICS PERSPECTIVE9e.docxSupply ChainManagementA LOGISTICS PERSPECTIVE9e.docx
Supply ChainManagementA LOGISTICS PERSPECTIVE9e.docx
 
Summative Productivity Lab Maxi Widjojo IB S1 ESS Mrs. .docx
Summative Productivity Lab Maxi Widjojo  IB S1 ESS Mrs. .docxSummative Productivity Lab Maxi Widjojo  IB S1 ESS Mrs. .docx
Summative Productivity Lab Maxi Widjojo IB S1 ESS Mrs. .docx
 
Summative Discussion BoardReview and reflect on the knowledg.docx
Summative Discussion BoardReview and reflect on the knowledg.docxSummative Discussion BoardReview and reflect on the knowledg.docx
Summative Discussion BoardReview and reflect on the knowledg.docx
 
Sun, sea, sand and tsunami examiningdisaster vulnerability .docx
Sun, sea, sand and tsunami examiningdisaster vulnerability .docxSun, sea, sand and tsunami examiningdisaster vulnerability .docx
Sun, sea, sand and tsunami examiningdisaster vulnerability .docx
 
Summary 1271 Wordssecond hand smoke55SIMILARITY.docx
Summary 1271 Wordssecond hand smoke55SIMILARITY.docxSummary 1271 Wordssecond hand smoke55SIMILARITY.docx
Summary 1271 Wordssecond hand smoke55SIMILARITY.docx
 
Superior Electrical (Superior) was in the business of installing ele.docx
Superior Electrical (Superior) was in the business of installing ele.docxSuperior Electrical (Superior) was in the business of installing ele.docx
Superior Electrical (Superior) was in the business of installing ele.docx
 
Superstorm scenario–a so-called Superstorm” is predicted to affe.docx
Superstorm scenario–a so-called Superstorm” is predicted to affe.docxSuperstorm scenario–a so-called Superstorm” is predicted to affe.docx
Superstorm scenario–a so-called Superstorm” is predicted to affe.docx
 
Supply Chain ManagementSTRATEGY, PLANNING, AND OPERATION.docx
Supply Chain ManagementSTRATEGY, PLANNING, AND OPERATION.docxSupply Chain ManagementSTRATEGY, PLANNING, AND OPERATION.docx
Supply Chain ManagementSTRATEGY, PLANNING, AND OPERATION.docx
 

Recently uploaded

Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 

Recently uploaded (20)

This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 

Suppose a zoo wants a C++ program to keep track of its animals and t.docx

  • 1. Suppose a zoo wants a C++ program to keep track of its animals and to provide information for visitors. Suppose the following class is the base class of an public inheritance hierarchy. class Animal { public: Animal( string &nme ); private: string name; // The particular animal’s name }; Animal::Animal( string &nme ) : name( nme ) {} Create a derived class that represents a specific group or family of animals, and derive from that another class that represents an even more specific family or an individual species. For example, your classes could be Bear and PolarBear , or Cat and Lion . Each of your classes should publicly inherit from the next larger class up the inheritance chain (e.g. PolarBear inherits from Bear and Bear inherits from Animal. ) Each of your classes should contain a private static
  • 2. data member representing something that is true of all objects of that class. (e.g. for PolarBear , it might be a Boolean isWhite). Post the C++ declaration of your two classes and show the constructor code and the initialization of the static data members.