Concept explainers
Consider the following class definitions: (2, 8)
Which private members, if any, of smart are public members of superSmart?
Which members, functions, and/or data, of the class smart are directly accessible in class superSmart?
Want to see the full answer?
Check out a sample textbook solutionChapter 11 Solutions
C Programming: From Problem Analysis to Program Design
- class Base { public: int x, y: public: Base(int i, int j) { x = i; y = j; }}; class Derived : public Base public: Derived (int i, int j) { x = i; y = j; void display() {cout « x <<" "<< y; }}; int main(void) { Derived d(5, 5); d.display(); return e; Error O X=5,Y=5 X-0,Y=0 None of the above Other:arrow_forwardData Structuresarrow_forward26. Assume the declaration of Exercise 24. A. Write the statements that derive the class dummyClass from class base as a private inheritance. (2 lines are { and }.) "A1 is { "A2 is "A3 is )) B. Determine which members of class base are private, protected, and public in class dummyClass. "B1 is dummyClass is a dearrow_forward
- PROGRAMMING LANGUAGE: C++ SUBJECT: OOP Task: Suppose you have a class Rectangle with data members width and height. The public member functions of class Rectangle are as follows: setValues(int w, int h); // to set values of width and height of objects of Rectangle class int Area();// to find area of an object of rectangle class biggerRectangle(Rectangle A, Rectangle B); prints the rectangle details which is bigger. Sample Code for passing object to a function is given below: #include <iostream> using namespace std; class CRectangle { int width, height; public: void set_values (int, int); int area () {return (width * height);} void copyData(CRectangle rect); }; void CRectangle::copyData(CRectangle rect) { width=rect.width; height=rect.height; cout<<"width of c = "<<width<<", height of c= "<<height<<endl; } void CRectangle::set_values (int a, int b) { width = a; height = b; } int main () { CRectangle a,b,c;…arrow_forwardAPEX Test Class - Salesforce Please Desgin the Apex Test Class to solve the below problem public with sharing class MyFirstClass{ // Variable to store the values to perform the multiplication logic static Integer a = 5; static Integer b= 9; public static Integer productOfTwoNumbers; public static void multipicationOfTwoNumber() { //Product of the two Numbers productOfTwoNumbers = a * b; }arrow_forwarda) Given the following code segments: class MyClass { String name; double value; MyClass (String n, double v) { name = n; value =v; } String getName () { return name; } double getValue () { return value; } } (i) Explain what is immutable object.arrow_forward
- Vending Machinearrow_forwarddata structures in javaarrow_forwardclass A {protected int x1,y1,z; public: A(a, b,c):x1(a+2),y1(b-1),z(c+2) { for(i=0; i<5;i++) x1++; y1++;z++;}}; class B {protected: int x,y; public: B(a,b):x(a+1),y(b+2) { for(i=0; i<5;i++) x+=2; y+=1;}}; class D:public B, virtual public A { private: int a,b; public: D(k,m,n): a(k+n), B(k,m),b(n+2),A(k,m,n) { a=a+1;b=b+1;}}); int main() {D ob(4,2,5);} what the values of x1,y1 and zarrow_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