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 polymorphism explain its types?
Define a class to represent a bank account. Include the following members: Data Members: Name of the Depositor Account Number Type of Account Balance amount in the account Member Functions: To assign the initial values. To deposit an account. To withdraw an amount after checking the balance. Write a C++ main program to display account number, name and balance.
what are the ways in which a constructors can be called?
how to find the correct email address format by using the programe?
What are oops methods?
Can we override main method?
sir plz send me a set of questions that been frequently held in written examination during campus selection.
What is virtual function?where and when is it used?
can you give the dynamic polymorphism types?
which feature are not hold visual basic of oop?
What is abstraction with example?
What are callback functions in c++