Concept explainers
write the definition of a class Triangle in c++ containing:
a data member base of type double.
a data member height of type double.
a default constructor that assigns the values 25 and 20 to the member variable base and height, respectively.
an overloading constructor that accepts two arguements of type double and assigns them to the base and height member varaibles
a member function called getBase that accepts no parameters and returns the value of base.
a member function called getHeight that accepts no parameters and returns the value of height.
a member function called getArea that accepts no parameters and returns the area of the triangle.
a destructor that displays the following message on the screen: Triangle is destroyed.
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 3 images
- a. Python does not directly enforce public and private member access and so will not generate an error if you fail to respect the convention. O b. Python supports the concept of public and private through convention - by adding an underscore '_' at the beginning of the member function or variable. C. Just like other languages that support Object Oriented Programming, such as C++ and Java, Python strictly enforces the concept of public and private class members and will generate an error when it runs if you try to access a private member from outside of the class. O d. Python does not support the concepts of public and private members of a class.arrow_forwardwrite in c++ Declare an arbitrary class and create an object of this class and write a prototype of the member function for you class that overloads assignment operator "="arrow_forwardA member variable declared in the private section of a base class can be directly accessed within a member function of a derived class that inherits from this base class. True Falsearrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education