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 |
JAVA is FULLY OBJECT ORIENTED PROGRAMING LANGUAGE?
what is the difference b/w abstract and interface?
2 Answers Merrill Lynch, Schneider, Scio Healthcare,
what is Class in oops with example?
What are the 5 oop principles?
What is the use of fflush(stdin) in c++?
What does the code "cout<<(0==0);" print? 1) 0 2) 1 3) Compiler error: Lvalue required
write a progra in c++ using class & object to find out wheather a given no. is prim or not.
Which is better struts or spring?
What is abstraction in oops?
Why it is called runtime polymorphism?
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?