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
Mkey [24]
3 years ago
8

5)What are the differences in the function calls between the four member functions of the Shape class below?void Shape::member(S

hape s1, Shape s2);void Shape::member(Shape *s1, Shape *s2);void Shape::member(Shape& s1, Shape& s2) const;void Shape::member(const Shape& s1, const Shape& s2);void Shape::member(const Shape& s1, const Shape& s2) const;
Computers and Technology
1 answer:
Stells [14]3 years ago
5 0

Answer:

void Shape :: member ( Shape s1, Shape s2 ) ; // pass by value

void Shape :: member ( Shape *s1, Shape *s2 ) ; // pass by pointer

void Shape :: member ( Shape& s1, Shape& s2 ) const ; // pass by reference

void Shape :: member ( const Shape& s1, const Shape& s2 ) ; // pass by const reference

void Shape :: member ( const Shape& s1, const Shape& s2 ) const ; // plus the function is const

Explanation:

void Shape :: member ( Shape s1, Shape s2 ) ; // pass by value

The s1 and s2 objects are passed by value as there is no * or & sign with them. If any change is made to s1 or s2 object, there will not be any change to the original object.

void Shape :: member ( Shape *s1, Shape *s2 ) ; // pass by pointer

The s1 and s2 objects are passed by pointer as there is a * sign and not & sign with them. If any change is made to s1 or s2 object, there will be a change to the original object.

void Shape :: member ( Shape& s1, Shape& s2 ) const ; // pass by reference

The s1 and s2 objects are passed by reference  as there is a & sign and not * sign with them. If any change is made to s1 or s2 object.

void Shape :: member ( const Shape& s1, const Shape& s2 ) ; // pass by const reference

The s1 and s2 objects are passed by reference  as there is a & sign and not * sign with them. The major change is the usage of const keyword here. Const keyword restricts us so we cannot make any change to s1 or s2 object.

void Shape :: member ( const Shape& s1, const Shape& s2 ) const ; // plus the function is const

The s1 and s2 objects are passed by reference  as there is a & sign and not * sign with them. const keyword restricts us so we cannot make any change to s1 or s2 object as well as the Shape function itself.

You might be interested in
A(n) __________ employs a method called "tunneling" in which each packet from the sending computer is encapsulated within anothe
Hitman42 [59]
<span>Virtual Private Network employs a method called "tunneling" in which each packet from the sending computer is encapsulated within another packet before being sent over the internet.Tunneling protocol allows a network user to access or provide a network service that the underlying network does not support or provide directly</span>
7 0
3 years ago
Flash drives plug into a(n) _
Alecsey [184]
A flash drive plugs into a USB Port
7 0
3 years ago
Read 2 more answers
How does confidentiality protect people and their online activity?
zlopas [31]
The answer is C Explanation: process of elimination
5 0
3 years ago
Lab Goal : This lab was designed to demonstrate the similarities and differences in a for loop and a while loop.Lab Description
Mandarinka [93]

Answer:

See Explanation

Explanation:

Required:

Use for and while loop for the same program

<u>(1) String Cleaner</u>

#For Loop

name = "I am Sam"

result = ""  

<em>for i in range(0, len(name)):  </em>

<em>    if name[i]!= 'a':  </em>

<em>        result = result + name[i] </em>

print(result)

#While Loop

name = "I am Sam"

result = ""  

<em>i = 0 </em>

<em>while i < len(name): </em>

<em>    if name[i]!= 'a':  </em>

<em>        result = result + name[i] </em>

<em>    i+=1 </em>

print(result)

<u>(2): Common Divisor</u>

#For Loop

num1 = 528

num2 = 60

div = num2

if num1 > num2:

   div = num1

<em>for i in range(2,div):</em>

<em>    if num1%i == 0 and num2%i==0:</em>

<em>        print(i,end = " ")</em>

print()

#While Loop

num1 = 528

num2 = 60

div = num2

if num1 > num2:

   div = num1

i = 2

<em>while i <div:</em>

<em>    if num1%i == 0 and num2%i==0:</em>

<em>        print(i,end = " ")</em>

   i+=1

The iterates statements show the difference in the usage of both loops.

For the for loop, the syntax is:

<em>for [iterating-variable] in range(begin,end-1)</em>

<em>-------</em>

<em>---</em>

<em>--</em>

<em />

For the while loop, the syntax is:

<em>while(condition)</em>

<em>-------</em>

<em>---</em>

<em>--</em>

8 0
3 years ago
why is it important for you to understand and describe the internal and external components of a computer in the workplace​
zhannawk [14.2K]

Hi! I have been troubleshooting and building PCs all my life and I find it very important to know the the internal core components of a PC and how they function that way when errors occur you can attempt to fix the problem.

Ex1: Lets say your BIOS identifies a problem with a RAM slot you would be able to know that your RAM slot is either shorted or there is a problem with the RAM stick you inserted.

Ex2: Now your monitor is flashing and turning colors randomly. You could make an inference that either your monitor is prongs are broken, your cable prongs could be bent, your cable might not be plugged in all the way, or your external or integrated GPU is toast.

Hope this might've showed you something

Aaron

7 0
3 years ago
Other questions:
  • What is TCP/IP's Transport layer's primary duty?
    8·1 answer
  • Write a function that finds the number of occurrences of a specified character in the string using the following header: def cou
    9·1 answer
  • In order for two computers to communicate via the internet, they must first locate one another. How do computers locate one anot
    12·1 answer
  • 1 Explain the difference between using a computer program and programming a computer.
    12·1 answer
  • My friend Leo wants to have an emergency plan for his final exams on University of Southern Algorithmville. He has N subjects to
    9·1 answer
  • When you begin creating a new powerpoint presentation, you need to select a ____.?
    13·1 answer
  • Consider the classes below: public class TestA { public static void main(String[] args) { ​ int x = 2; ​ int y = 20 ​ int counte
    6·1 answer
  • How can you make sure to save all annotations from a slide show?
    7·2 answers
  • HELP ASAP WILL GIVE BRAINLY Question 19 Multiple Choice Worth 5 points) (05 03 MC) Network technologies specialist Hannah has be
    12·1 answer
  • The difference between tool bar and status bar​
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!