1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
alukav5142 [94]
3 years ago
14

c++ design a class named myinteger which models integers. interesting properties of the value can be determined. include these m

embers: a int data field named value that represents the integer's value. a constructor that creates a myinteger object with a specified int value. a constant getter that returns the value
Computers and Technology
1 answer:
klemol [59]3 years ago
4 0

Answer:

  1. #include <iostream>
  2. using namespace std;
  3. class myinteger {
  4.    
  5.    private:
  6.        int value;
  7.        
  8.    public:
  9.        myinteger(int x){
  10.            value = x;
  11.        }
  12.        
  13.       int getValue(){
  14.           return value;
  15.       }
  16.        
  17. };
  18. int main()
  19. {
  20.    myinteger obj(4);
  21.    cout<< obj.getValue();
  22.    return 0;
  23. }

Explanation:

Firstly, we use class keyword to create a class named myinteger (Line 5). Define a private scope data field named value in integer type (Line 7 - 8).

Next, we proceed to define a constructor (Line 11 - 13) and a getter method for value (Line 15 -17) in public scope. The constructor will accept one input x and set it to data field, x. The getter method will return the data field x whenever it is called.

We test our class by creating an object from the class (Line 23) by passing a number of 4 as argument. And when we use the object to call the getValue method, 4 will be printed as output.

You might be interested in
Which of the following actions is an example of "window dressing?" a. Using some of the firm’s cash to reduce long-term debt. b.
marshall27 [118]

Answer:

Option D is the correct option.

Explanation:

Window dressing is the type of process by which a firm provides the improvement in fundamental or long-run positions and also they develop their basic values. It does not use the assets of the firm to minimize the long-term debt. So, that's why It borrows the long-term debts through retire the short-term debt that maintain the present ratio of the firm.

6 0
3 years ago
Fill in the correct formula called a contains numbers from Rhodes 1 to 20 you can use the formula blank to find the volume of th
Flauer [41]

Answer:

Waist

Explanation:

5 0
3 years ago
HELP ASAP!!!
stiks02 [169]
Comparison would be most suitable. I hope I could be a help


7 0
3 years ago
Read 2 more answers
What is the range of values that a short can represent?
ikadub [295]

Answer:

c. Math.pow(-2.0,15.0) to (Math.pow(2.0,15.0) -1).

Explanation:

short represents a 16-bit signed integer. short is used to save memory because it occupies less space than integers where integers occupy 4 bytes short occupies 2 bytes.

Since it is signed so first bit is used to represent the sign if 0 then positive and 1 then the integer is negative.We are left with 15 bits.

So the range is -2¹⁵ to 2¹⁵-1.

Hence the answer is option c.

3 0
2 years ago
The fraction 460/7 is closest to which of the following whole numbers?
Bess [88]
I don’t see any of “the following numbers”
3 0
3 years ago
Other questions:
  • 6. A distribution consists of three components with frequencies 200, 250 and 300 having means
    14·1 answer
  • A byte is made up of 8 bits (binary digits). You have a programming language that uses one byte to represent characters and are
    5·1 answer
  • In determining where to store specific data in a(n) centralized DBMS, factors such as communications cost, response time, storag
    12·1 answer
  • ______ is a type of computer software that is installed into devices such as printers, print servers, and various types of commu
    5·1 answer
  • Which result is most likely if a network packet has no header?
    9·2 answers
  • NEED HELP
    9·1 answer
  • Lasses give programmers the ability to define their own types. <br><br> a. True<br> b. False
    10·1 answer
  • HELP MEEE PLEASE!!!
    11·1 answer
  • A(n) _____ is a data validation rule that should be applied to mandatory data items.
    15·1 answer
  • to provide for ecmascript compatibility in older browsers, you can use group of answer choices javascript shivs javascript shims
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!