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 ? | 11 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 |
IN PROGRAMING LANGAUGE A C++ IS PURELY OBJECT ORIENTED OR NOT?
What is operator overloading? Give Example
11 Answers CTS, IBM, TCS,
What are the 4 pillars of oop?
what is inline function?
what is multithreading in c++ , what is difference between multithreading and singlethreading.
what are the realtime excercises in C++?
What are benefits of oop?
write string class as your own class in java without using any built-in function
what is an qt4 interface?
Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the maximum number of concurrent threads that the InnoDB plug-in can create.
What is encapsulation selenium?
if i have same function with same number of argument but defined in different files. Now i am adding these two files in a third file and calling this function . which will get called and wht decide the precedence?