There are 2 classes defined as below
public class A
{
class B b;
}
public class B
{
class A a;
}
compiler gives error. How to fix it?
Answer Posted / santhosh
by Forward declaring,
class B;
public class A
{
class B b;
}
public class B
{
class A a;
}
| Is This Answer Correct ? | 12 Yes | 1 No |
Post New Answer View All Answers
What does enum stand for?
Question: 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.
Can bst contain duplicates?
What is an advantage of polymorphism?
How do you achieve polymorphism?
Why do pointers exist?
what type of question are asked in thoughtworks pair programming round ?
What is cohesion in oop?
What language is oop?
Write a java applet that computes and displays the squares of values between 25 and 1 inclusive and displays them in a TextArea box
Explain the concepts involved in Object Oriented programming.
What is object and example?
What is oops and its features?
#include
What is the real time example of encapsulation?