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 |
Difference between realloc() and free?
What is overloading and its types?
How would you stop a class from class from being derived or inherited.
What is R T T I ?
What is encapsulation example?
can you explain how to use JavaBean in Project
What is encapsulation and abstraction? How are they implemented in C++?
0 Answers Agilent, ZS Associates,
What is Inheritance, Multiple Inheritance, Shared and Repeatable Inheritance?
What are the valid types of data that the main () can return in C/C++ language
difine hierarchical inheritance.
What is encapsulation with real life example?
What is the use of unnamed namespaces in OOPS? The only advantage I know is that they dont need the scope resolution operator while accessing them. I want to know some other advantages of unnamed namespaces...