Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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



There are 2 classes defined as below public class A { class B b; } public class B { c..

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

There are 2 classes defined as below public class A { class B b; } public class B { c..

Answer / santhosh

class B;


public class A
{
B* b;
}
public class B
{
A a;
}

Is This Answer Correct ?    4 Yes 0 No

There are 2 classes defined as below public class A { class B b; } public class B { c..

Answer / praveen

public class A
{
class B *b;
}
public class B
{
class A a;
}

Is This Answer Correct ?    0 Yes 3 No

Post New Answer

More OOPS Interview Questions

write a program to find 2^n+1 ?

0 Answers   CTS,


What are the 5 oop principles?

0 Answers  


how can we design a magic square in c++?or suggest me the basic idea of it.

3 Answers  


what is main difference between object oriented object base

2 Answers   Wipro,


what are the characteristics of oops?

7 Answers   NIIT,


what are the disadvantages of C++?

25 Answers   ATS, Infosys, UNI, Wipro,


What are functions in oop?

0 Answers  


what are the ways in which a constructors can be called?

2 Answers   TCS,


c++ program to swap the objects of two different classes

0 Answers  


What normal C constructs work differently in C++?

2 Answers  


Can you explain polymorphism?

0 Answers  


what is the basic concept of inheritance?

9 Answers  


Categories