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?
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / santhosh
class B;
public class A
{
B* b;
}
public class B
{
A a;
}
| Is This Answer Correct ? | 4 Yes | 0 No |
Answer / praveen
public class A
{
class B *b;
}
public class B
{
class A a;
}
| Is This Answer Correct ? | 0 Yes | 3 No |
What is data binding?
What is a class in oop?
What is polymorphism programming?
difference between class and object
10 Answers Chandan, IBM, Magic Soft,
Why is polymorphism important in oop?
How to call a non virtual function in the derived class by using base class pointer
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.
Write a program to reverse a string using recursive function?
Can an interface inherit a class?
Explain virtual inheritance?
WAP find square root of any number (without using sqrt() )?
write a program to find the largest of two numbers without using for,while,switch,if else, conditional operator and do while using c++ pgmng language