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 |
What is the purpose of polymorphism?
Given two strings like x=?hello? and y=?open?, remove any character from string x which is also used in string y, thus making the result x=?hll?.
write a c++ code of diagonal matrix.
What is data binding in oops?
What is the correct syntax for inheritance? 1) class aclass : public superclass 2) class aclass inherit superclass 3) class aclass <-superclass
What is a function in oop?
Difference between over loading and over ridding?
12 Answers CTS, Patni, Softvision Solution,
There are two base class B1,B2 and there is one class D which is derived from both classes, Explain the flow of calling constructors and destructors when an object of derived class is instantiated.
Get me an image implementation program.
How long to learn object oriented programming?
which structured data type is not used in c++? 1.union 2.structure 3.string 4.boolean
What does enum stand for?