#include using namespace std; class A { private: int x; public: A(int _x) { x = _x; } int get() { return x; } }; class B { static A a; public: static int get() { return a.get(); } }; int main(void) { B b; cout << b.get(); return 0; } Execute and provide screenshot.
Q: #include using namespace std; class Creature { public: Creature(); void…
A: #include <iostream> using namespace std; class Creature { public: Creature();…
Q: True or false ? Assuming class Quiz { public: void TakeIt ( ); }; Quiz cs2b_quiz; Quiz * p_quiz…
A: class Quiz { public: void TakeIt ( ); }; Quiz cs2b_quiz; //declare cs2b_quiz Quiz * p_quiz =…
Q: What is the output of above code.
A: Given: Two Class A and B, in which Class B is derived from Class A. Class B is derived class here.…
Q: }; private: AeroCar(double new height, double new_speed); const; { void display_data() AeroCar::…
A: C++ is an object-oriented generic programming language for creating software, and it is a…
Q: #include #include using namespace std; //define class & its public/private members class…
A: 1. Create a class called bankAccount with public and protected members. 2. Create a constructor that…
Q: class A{ public: class B{ public:
A: Answer: False
Q: include void fun1(int num, ...); void fun2(int num, ...); int main() { fun1(1, "Apple", "Boys",…
A: Explanation: The code defines two functions, fun1 and fun2, which have variable arguments. In the…
Q: class A {protected int x1,1,2; public: A(a, b,c):x1(a+2),y1(b-1),z(c+2) { for(i=0; i<5;i++)…
A: Explanation: Consider the given code. The values of k, m, and n are 4, 2, and 5 respectively. The…
Q: CSE LAB APEX Test Class - Salesforce Please Desgin the Apex Test Class to solve the below problem…
A: In this problem, we need to Please Desgin the Apex Test Class to solve the below problem Please…
Q: 1. class rectangle { 2 private: 3. double width; double length; 5. public: rectangle(double w=0.0,…
A:
Q: For the “Class C”: There is 2 ways for fixing this functions. Firstly fix the “yaz” and “yaz2” error…
A: The given code is in C++ language with inheritance where 1) Class A is parent class 2) Class B…
Q: Plese filx this program #include #include class fibo { private long int fo, fl, fib;…
A: Required: to fix the given program: #include<iostream.h> #include<conio.h> class fibo {…
Q: Consider the following code: class A { public: virtual void printChar() { cout…
A: The code defines two classes, A and B, where B is derived from A. The printChar() function is…
Q: #include #include void fun1(int num, ...); void fun2(int num, ...); int main() { fun1(1, "Apple",…
A: Include the necessary header files: stdio.h for input/output operations and stdarg.h for handling…
Q: } class ChoiceQuestion public Question { public: ChoiceQuestion(); void set_text(string new_text);…
A: In object-oriented programming (OOP), the idea of function overriding is used when a subclass offers…
Q: Consider the following code: class A { public: void printChar() { cout printChar();…
A: The mechanism of developing and implementing an executable computer program to achieve a particular…
Q: #include using namespace std; class Creature { public: Creature(); void…
A: Given: #include <iostream> using namespace std; class Creature { public: Creature();…
#include <iostream>
using namespace std;
class A
{
private:
int x;
public:
A(int _x) { x = _x; }
int get() { return x; }
};
class B
{
static A a;
public:
static int get()
{ return a.get(); }
};
int main(void)
{
B b;
cout << b.get();
return 0;
}
Execute and provide screenshot.
Step by step
Solved in 2 steps with 1 images
- C++ complete and create magical square #include <iostream> using namespace std; class Vec {public:Vec(){ }int size(){return this->sz;} int capacity(){return this->cap;} void reserve( int n ){// TODO:// (0) check the n should be > size, otherwise// ignore this action.if ( n > sz ){// (1) create a new int array which size is n// and get its addressint *newarr = new int[n];// (2) use for loop to copy the old array to the// new array // (3) update the variable to the new address // (4) delete old arraydelete[] oldarr; } } void push_back( int v ){// TODO: if ( sz == cap ){cap *= 2; reserve(cap);} // complete others } int at( int idx ){ } private:int *arr;int sz = 0;int cap = 0; }; int main(){Vec v;v.reserve(10);v.push_back(3);v.push_back(2);cout << v.size() << endl; // 2cout << v.capacity() << endl; // 10v.push_back(3);v.push_back(2);v.push_back(3);v.push_back(4);v.push_back(3);v.push_back(7);v.push_back(3);v.push_back(8);v.push_back(2);cout…Microsoft Visual C# 7th edition, debugging 9-2 Instruction: The provided file has syntax and/or logical errors. Determine the problem(s) and fix the program. // Creates a Breakfast class // and instantiates an object // Displays Breakfast special information using System; using static System.Console; using System.Globalization; class DebugNine2 { static void Main() { Breakfast special = new Breakfast("French toast, 4.99); //Display the info about breakfast WriteLine(INFO); // then display today's special WriteLine("Today we are having {1} for {1}", special.name, special.Price.ToString("C2", CultureInfo.GetCultureInfo("en-US"))); } } class Breakfast { public string INFO = "Breakfast is the most important meal of the day."; // Breakfast constructor requires a // name, e.g "French toast", and a price public Breakfast(string name, double price) { name = name; price = price; } public string Name…Q1 function myFunc() { let a = 10; if (true) { Q3 } } let a = 5; console.log(a); Q4 console.log(a); Q2 const square = num => num * num; console.log(square(3) + 5); myFunc(); let x = 30; let y "200"; console.log(x+y); const nums = [10, 20, 8, 17]; nums.filter(e=> e > 10); console.log(nums); Q5 const nums = [30, 35, 42, 20, 15]; console.log(nums.every (num => num > 20)); January 15
- //Please Fix this program #include<iostream>using namespace std;class Point{private:int x, y;public:Point() {}Point(int x1, int y1) { x = x1; y = y1; }Point(const Point &p1) {x = p1.x; y = p1.y; } // Copy constructorint getX() { return x; }int getY() { return y; }};int main(){Point p0(); // Calling Default ConstructorPoint p1(10, 15); // Calling Parameterized constructorPoint p2 = p1; // Calling Copy constructorcout << "p0.x = " << p0.getX() << ", p0.y = " << p0.getY();cout << "p1.x = " << p1.getX() << ", p1.y = " << p1.getY();cout << "\np2.x = " << p2.getX() << ", p2.y = " << p2.getY();return 0;}class 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 zC++ language patient.h /*preventing multiple inclusion of header files using#ifndef and #define directives */#ifndef PATIENT_H#define PATIENT_H#include<iostream>using namespace std;class patient{ //declaring instance variables private: string firstName; string lastName; int id; public: //default constructor declaration patient(); //parameterized constructor declaration patient(string fName,string lName,int pId); //print() function declaration void print(); //setter functions declaration void setFirstName(string fName); void setLastName(string lName); void setId(int pId);};#endif patient class implementation patient.cpp #include "patient.h"//default constructor implementationpatient::patient(){ firstName=""; lastName=""; id=0;}//parameterized constructor implementationpatient::patient(string fName,string lName,int pId){ firstName=fName; lastName=lName; id=pId;}//print function…
- class 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() (Dob(4,2,5);} what the values of x1,y1 and z#include using namespace std; (а) class Fraction{ int x, y; public: Fraction (int a, int b) {x=a; y=b;}; int getx(){return x;} int gety() {return y;} } ; int main() Fraction n(3, 7); ++n; cout << "x/y: " <« n.getx()<< "/" « n.gety()<void fun(int i) { do { if (i % 2 != 0) cout =1); cout << endl; } int main() { int i = 1; while (i <= 8) { fun(i); it; } cout <C# Solve this error using System; namespace RahmanA3P1BasePlusCEmployee { public class BasePlusCommissionEmployee { public string FirstName { get; } public string LastName { get; } public string SocialSecurityNumber { get; } private decimal grossSales; // gross weekly sales private decimal commissionRate; // commission percentage private decimal baseSalary; // base salary per week // six-parameter constructor public BasePlusCommissionEmployee(string firstName, string lastName, string socialSecurityNumber, decimal grossSales, decimal commissionRate, decimal baseSalary) { // implicit call to object constructor occurs here FirstName = firstName; LastName = lastName; SocialSecurityNumber = socialSecurityNumber; GrossSales = grossSales; // validates gross sales CommissionRate = commissionRate; // validates commission rate BaseSalary = baseSalary; // validates base…6. class PPP int H: protected : int S; public : void input (int); void out (); }; class Q0Q : private PPP int T; protected : int U; public : void indata (int, int); void outdata (); }; class RRR : public Q0Q int M; public : void disp (); }; int main () 002 objl; RRR obj2; return 0; a. In the above code, is the member function out() accessible by obj1? b. Name the member function(s), which can be accessed from the obj2? c. Name the data member(s) that can be accessed from function disp().C++SEE MORE QUESTIONSRecommended textbooks for youDatabase 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:PEARSONC 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 EducationDatabase 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:PEARSONC 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