What will the following
#include <iostream.>
using namespace std;
class First
{
protected:
int a;
public:
First(int x = 1)
{ a = x; }
void twist()
{ a *= 2; }
int getVal()
{ twist(); return a; }
}:
class Second : public First
{
private:
int b;
public:
Second(int y = 5)
{ b = y; }
void twist()
{ b *= 10: }
}:
int main()
{
First object1;
Second object2;
cout ≪ object1.getVa˥ ()≪ end˥
cout ≪ object2.getVa˥ ()≪ end˥return 0:
Want to see the full answer?
Check out a sample textbook solutionChapter 15 Solutions
Starting Out with C++ from Control Structures to Objects (9th Edition)
Additional Engineering Textbook Solutions
Electric Circuits. (11th Edition)
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Thinking Like an Engineer: An Active Learning Approach (4th Edition)
SURVEY OF OPERATING SYSTEMS
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Starting Out With Visual Basic (8th Edition)
- Explain below code #include <iostream>#include <cmath>using namespace std; const int DIAMETER = 20; // diameter of each ringconst int SPACE = 5; // space between rings class Circle{ public: void drawOlympicRings(int RINGS) { for (int y = 0; y < DIAMETER; y++) { for (int x = 0; x < RINGS * (DIAMETER + SPACE) - SPACE; x++) { bool draw = false; // calculate the distance from the center of each ring for (int i = 0; i < RINGS; i++) { int cx = (DIAMETER / 2) + i * (DIAMETER + SPACE); int cy = DIAMETER / 2; int dx = x - cx; int dy = y - cy; float d = sqrt(dx * dx + dy * dy); if (d <= DIAMETER / 2) { draw = true;…arrow_forwardC++arrow_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