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
Does anybody know how to get this little search bar thing off of my task bar on a HP laptop.
Paul [167]
Try clicking the down arrow on the search bar or right clicking it and selecting an option no if that doesn’t work then drag the || to somewhere or right click it. If none of those work you can right click the taskbar and see if there is anything that looks like it could be the search bear and uncheck it
4 0
2 years ago
Does the Main Content (MC) of a web page include searchboxes?
Tanzania [10]
Yes it does use search boxes
8 0
3 years ago
Read 2 more answers
How to delete the last element in array
svlad2 [7]

Answer:

Hey mate.....

Explanation:

This is ur answer.....

<em>To remove the last n elements from an array, use arr. splice(-n) (note the "p" in "splice"). The return value will be a new array containing the removed elements.</em>

<em />

Hope it helps!

Mark me brainliest pls.....

FOLLOW ME! :)

4 0
3 years ago
What does obsolete mean?
Alex
No longer produced or used; out of date.
8 0
3 years ago
Read 2 more answers
When typing an outline, you can move a point from a lower level to a higher level by changing the list level from the outline me
Arte-miy333 [17]
A shift+Tab
I hope it’s work
6 0
3 years ago
Other questions:
  • A word or line of a paragraph at the top of a page hanging indent is called ______
    8·1 answer
  • What file may contain data written to it in case of an unexpected error or program shut-down?
    5·1 answer
  • What is the name used for the camera s view from a single position?
    9·1 answer
  • What is the easiest way to create a resume in Word with predefined content that can be replaced with your information?
    13·2 answers
  • Check my work a(n) ________ reference is an automatically created variable that holds the address of an object and passes it to
    15·1 answer
  • What is the IEEE 802 standards name for a wireless network that is limited to one person's workspace?
    14·1 answer
  • What is the process of adding random characters at the beginning or end of a password to generate a completely different hash ca
    10·1 answer
  • Differentiate between tabular and column form layout​
    14·1 answer
  • Which keyboard shortcut would you press to copy cells that are selected in a spreadsheet?
    14·1 answer
  • What dictionary operation can you use to remove all the keys within the dictionary-named contacts?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!