Friend Class and Friend Function [on hold]
up vote
-5
down vote
favorite
- Create a class named ‘Shape’ with private data members Radius and Height. Also create a setInfo() function of this class with two parameters which are assigned to Radius and Height. Now create another class named ‘Cylinder’ which has two functions:
i) Calculate_Surface_Area : This function calculate the surface area of a cylinder
ii) Calculate_Volume : This function calculate the volume of a cylinder
Now this functions needs to access the private members of class ‘Shape’ to perform their respective operations. Now design this scenario with the concept of Friend Class. Finally create proper objects of the classes to print the Surface area and Volume of a Cylinder. N.B. Surface area of a cylinder = 2πr(r + h)
Volume of a cylinder = πr2h
c++
New contributor
Computer Problem Solve 360 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
put on hold as off-topic by ratchet freak, Toby Speight, t3chb0t, Heslacher, Graipher 2 days ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – ratchet freak, Toby Speight, t3chb0t, Heslacher, Graipher
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
up vote
-5
down vote
favorite
- Create a class named ‘Shape’ with private data members Radius and Height. Also create a setInfo() function of this class with two parameters which are assigned to Radius and Height. Now create another class named ‘Cylinder’ which has two functions:
i) Calculate_Surface_Area : This function calculate the surface area of a cylinder
ii) Calculate_Volume : This function calculate the volume of a cylinder
Now this functions needs to access the private members of class ‘Shape’ to perform their respective operations. Now design this scenario with the concept of Friend Class. Finally create proper objects of the classes to print the Surface area and Volume of a Cylinder. N.B. Surface area of a cylinder = 2πr(r + h)
Volume of a cylinder = πr2h
c++
New contributor
Computer Problem Solve 360 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
put on hold as off-topic by ratchet freak, Toby Speight, t3chb0t, Heslacher, Graipher 2 days ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – ratchet freak, Toby Speight, t3chb0t, Heslacher, Graipher
If this question can be reworded to fit the rules in the help center, please edit the question.
3
Welcome to Code Review. It seems you didn't get the purpose of this site. We review your code...we don't write code for you.
– Heslacher
2 days ago
Another HW assignment!
– Chad G
2 days ago
add a comment |
up vote
-5
down vote
favorite
up vote
-5
down vote
favorite
- Create a class named ‘Shape’ with private data members Radius and Height. Also create a setInfo() function of this class with two parameters which are assigned to Radius and Height. Now create another class named ‘Cylinder’ which has two functions:
i) Calculate_Surface_Area : This function calculate the surface area of a cylinder
ii) Calculate_Volume : This function calculate the volume of a cylinder
Now this functions needs to access the private members of class ‘Shape’ to perform their respective operations. Now design this scenario with the concept of Friend Class. Finally create proper objects of the classes to print the Surface area and Volume of a Cylinder. N.B. Surface area of a cylinder = 2πr(r + h)
Volume of a cylinder = πr2h
c++
New contributor
Computer Problem Solve 360 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
- Create a class named ‘Shape’ with private data members Radius and Height. Also create a setInfo() function of this class with two parameters which are assigned to Radius and Height. Now create another class named ‘Cylinder’ which has two functions:
i) Calculate_Surface_Area : This function calculate the surface area of a cylinder
ii) Calculate_Volume : This function calculate the volume of a cylinder
Now this functions needs to access the private members of class ‘Shape’ to perform their respective operations. Now design this scenario with the concept of Friend Class. Finally create proper objects of the classes to print the Surface area and Volume of a Cylinder. N.B. Surface area of a cylinder = 2πr(r + h)
Volume of a cylinder = πr2h
c++
c++
New contributor
Computer Problem Solve 360 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Computer Problem Solve 360 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Computer Problem Solve 360 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 2 days ago
Computer Problem Solve 360
1
1
New contributor
Computer Problem Solve 360 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Computer Problem Solve 360 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Computer Problem Solve 360 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
put on hold as off-topic by ratchet freak, Toby Speight, t3chb0t, Heslacher, Graipher 2 days ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – ratchet freak, Toby Speight, t3chb0t, Heslacher, Graipher
If this question can be reworded to fit the rules in the help center, please edit the question.
put on hold as off-topic by ratchet freak, Toby Speight, t3chb0t, Heslacher, Graipher 2 days ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – ratchet freak, Toby Speight, t3chb0t, Heslacher, Graipher
If this question can be reworded to fit the rules in the help center, please edit the question.
3
Welcome to Code Review. It seems you didn't get the purpose of this site. We review your code...we don't write code for you.
– Heslacher
2 days ago
Another HW assignment!
– Chad G
2 days ago
add a comment |
3
Welcome to Code Review. It seems you didn't get the purpose of this site. We review your code...we don't write code for you.
– Heslacher
2 days ago
Another HW assignment!
– Chad G
2 days ago
3
3
Welcome to Code Review. It seems you didn't get the purpose of this site. We review your code...we don't write code for you.
– Heslacher
2 days ago
Welcome to Code Review. It seems you didn't get the purpose of this site. We review your code...we don't write code for you.
– Heslacher
2 days ago
Another HW assignment!
– Chad G
2 days ago
Another HW assignment!
– Chad G
2 days ago
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
3
Welcome to Code Review. It seems you didn't get the purpose of this site. We review your code...we don't write code for you.
– Heslacher
2 days ago
Another HW assignment!
– Chad G
2 days ago