#include<iostream.h>
//main()
//{
class A
{
friend class B;
public:
void read();
};
class B
{
public :
int a,b;
};
void A::read()
{
cout<<"welcome";
}
main()
{
A x;
B y;
y.read();
}
In the above program......,
as B is a friend of A B can have access to all members,i
cant access y.read .
could you please tell me the reason and what would i code
to execute this program?
Answer Posted / nn
declare friend class b under public
| Is This Answer Correct ? | 2 Yes | 3 No |
Post New Answer View All Answers
A suduco given & u hv 2 check if it is incomplete(blanks left),or correct or incorrect
How to Split Strings with Regex in Managed C++ Applications?
Write a C/C++ program that connects to a MySQL server and displays the global TIMEZONE.
Given a table of the form: Product Sold on A 1/1/1980 B 1/1/1980 C 1/1/1980 A 1/1/1980 B 1/1/1980 C 2/1/1980 A 2/1/1980 There are 30 products and 10,000 records of such type. Also the month period during which sales happened is given to u. Write the program to display the result as: Product Month No. of copies A January 12 A February 15 A March 27 B January 54 B February 15 B March 10 C January 37
Given a table of the form: Product Sold on A 1/1/1980 B 1/1/1980 C 1/1/1980 A 1/1/1980 B 1/1/1980 C 2/1/1980 A 2/1/1980 There are 30 products and 10,000 records of such type. Also the month period during which sales happened is given to u. Write the program to display the result as: Product Month No. of copies A January 12 A February 15 A March 27 B January 54 B February 15 B March 10 C January 37
Code for Easily Using Hash Table?
can you please write a program for deadlock that can detect deadlock and to prevent deadlock.
Code for Small C++ Class to Transform Any Static Control into a Hyperlink Control?
solve the problem in the programming language C++"if a five digit number is input through the keyboard.Write a program to calculate the sum of its digits(hint: use the modulus operator)
Question 1: Implement a base class Appointment and derived classes Onetime, Daily, Weekly, and Monthly. An appointment has a description (for example, “see the dentist”) and a date and time. Write a virtual function occurs_on(int year, int month, int day) that checks whether the appointment occurs on that date. For example, for a monthly appointment, you must check whether the day of the month matches. Then fill a vector of Appointment* with a mixture of appointments. Have the user enter a date and print out all appointments that happen on that date. *This Should Be Done IN C++
Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.
Write a simple encryption program using string function which apply the substitution method.
How can I Draw an ellipse in 3d space and color it by using graph3d?
how to write a program that opens a file and display in reverse order?
i really need help about this.. write a program to display the set of odd and even numbers separately. find the highest and lowest value of the given numbers.