cout << " In dClassOne::Display()"; bClass::Display(); cout <« " d1s = " « d1s <« endl; }; 28 29 30 31 32 void Print() 33 { 34 cout <« " In dClassOne::Print()"; 35 bClass::Print(); 36 cout <« " d1s « d1s « endl; %3D 37 } private: 38 string d1s; 39 }; class dClassTwo : public bClass 41 { 40 public: dClassTwo (string ddata = " dClassTwoData ", string bdata= " bClassDataFro 42 43 %3D 44 :bClass (bdata), d2s(ddata) {}; 45 virtual void Display(int i) 46 { 47 48 cout <« " In dClassTwo::Display()"; bClass::Display(); cout<<"d2s="<

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Display the output:

28
cout << "
In dClassOne::Display()";
29
bClass::Display();
I3D
30
cout <« " d1s = " « d1s « endl;
31
};
void Print()
33
{
34
cout « " In dClassOne::Print()";
35
bClass::Print();
36
cout « " d1s = " « d1s « endl;
37 } private:
38
string d1s;
39 };
class dClassTwo : public bClass
{
40
41
public:
dClassTwo(string ddata = " dClassTwoData ", string bdata= " bClassDataFromD2 ")
42
43
%3D
44
:bClass(bdata), d2s(ddata) {};
45
virtual void Display(int i)
46 {
47
48
cout <« " In dClassTwo::Display()"; bClass::Display(); cout<<"d2s="<<d2s<<"i="<<i< endl;
}; private:
string d2s;
};
49
50
52
void Output( bClass &R)
{
54
R.Display();
}
55
56
57
int main() {
bClass A("Object A");
dClassOne B("Object B");
60
dClassTwo C("Object C", "Object C ( ObjectC_A ) ");
61
bClass *Ptr;
62
Ptr
&B;
Ptr->Display();
Output(A);
Output(B);
A = B;
63
64
65
A.Display();
68
Ptr = &B;
%3D
69
Ptr->Print();
70
C.Display(3);
71
Ptr = &C;
Ptr->Display();
return 0; }
72
73
74
m 3 m33
345 670 90l 234 O7
60
n55 555O
556 666O 6
699
Transcribed Image Text:28 cout << " In dClassOne::Display()"; 29 bClass::Display(); I3D 30 cout <« " d1s = " « d1s « endl; 31 }; void Print() 33 { 34 cout « " In dClassOne::Print()"; 35 bClass::Print(); 36 cout « " d1s = " « d1s « endl; 37 } private: 38 string d1s; 39 }; class dClassTwo : public bClass { 40 41 public: dClassTwo(string ddata = " dClassTwoData ", string bdata= " bClassDataFromD2 ") 42 43 %3D 44 :bClass(bdata), d2s(ddata) {}; 45 virtual void Display(int i) 46 { 47 48 cout <« " In dClassTwo::Display()"; bClass::Display(); cout<<"d2s="<<d2s<<"i="<<i< endl; }; private: string d2s; }; 49 50 52 void Output( bClass &R) { 54 R.Display(); } 55 56 57 int main() { bClass A("Object A"); dClassOne B("Object B"); 60 dClassTwo C("Object C", "Object C ( ObjectC_A ) "); 61 bClass *Ptr; 62 Ptr &B; Ptr->Display(); Output(A); Output(B); A = B; 63 64 65 A.Display(); 68 Ptr = &B; %3D 69 Ptr->Print(); 70 C.Display(3); 71 Ptr = &C; Ptr->Display(); return 0; } 72 73 74 m 3 m33 345 670 90l 234 O7 60 n55 555O 556 666O 6 699
1
#include <iostream>
#include <string>
3.
nt
using namespace std;
4
class bClass
{
7
public:
bClass(string data = "bClassData"):bs(data) {};
virtual void Display()
8.
al
9.
10
{
cout << "In bClass::Display() ";
cout <« "bs = " « bs « endl;
11
12
13
};
14
void Print()
15
{
16
cout << "In bClass::Print() ";
17
cout << "bs
<« bs << endl;
18
}
private:
string bs;
};
19
20
21
22
class dClassOne : public bClass
23
{
public:
dClassOne(string data = "dClassOneData"):d1s(data) {};
virtual void Display()
24
25
26
27
{
cout <« " In dClassOne::Display()";
bClass::Display();
28
29
Transcribed Image Text:1 #include <iostream> #include <string> 3. nt using namespace std; 4 class bClass { 7 public: bClass(string data = "bClassData"):bs(data) {}; virtual void Display() 8. al 9. 10 { cout << "In bClass::Display() "; cout <« "bs = " « bs « endl; 11 12 13 }; 14 void Print() 15 { 16 cout << "In bClass::Print() "; 17 cout << "bs <« bs << endl; 18 } private: string bs; }; 19 20 21 22 class dClassOne : public bClass 23 { public: dClassOne(string data = "dClassOneData"):d1s(data) {}; virtual void Display() 24 25 26 27 { cout <« " In dClassOne::Display()"; bClass::Display(); 28 29
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education