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 ?    11 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is encapsulation selenium?

554


What is variable example?

599


Why is object oriented programming so hard?

616


write a C++ program for booking using constructor and destructor.

2055


which feature are not hold visual basic of oop?

1725






assume the program must insert 4 elements from the key board and then do the following programs.sequential search(search one of the elements),using insertion sort(sort the element) and using selection sort(sort the element).

1671


What is the benefit of oop?

570


What are two types of polymorphism?

614


Is enum a class?

607


Can we create object of abstract class?

579


What is polymorphism what are the different types of polymorphism?

566


What are the benefits of oop?

607


What is polymorphism in oops?

560


What is abstraction encapsulation?

661


What is the full form of oops?

613