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

JAVA is FULLY OBJECT ORIENTED PROGRAMING LANGUAGE?

3 Answers  


what is the difference b/w abstract and interface?

2 Answers   Merrill Lynch, Schneider, Scio Healthcare,


what is Class in oops with example?

4 Answers   HCL,


What are the 5 oop principles?

0 Answers  


What is the use of fflush(stdin) in c++?

4 Answers   HCL,


What does the code "cout<<(0==0);" print? 1) 0 2) 1 3) Compiler error: Lvalue required

15 Answers   ISTS, Wipro,


write a progra in c++ using class & object to find out wheather a given no. is prim or not.

2 Answers  


Which is better struts or spring?

0 Answers  


What is abstraction in oops?

0 Answers  


Why it is called runtime polymorphism?

0 Answers  


what is the new version of c++

1 Answers   Ignou, Pramata, Satyam,


Explain the concept of abstracion and encapsulation with one example. What is the difference between them?

3 Answers   PCS,


Categories