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?

Answer Posted / praveen

public class A
{
class B *b;
}
public class B
{
class A a;
}

Is This Answer Correct ?    0 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the two different types of polymorphism?

669


What are the data types in oop?

602


class type to basic type conversion

1833


Why it is called runtime polymorphism?

573


How to hide the base class functionality in Inheritance?

636






What causes polymorphism?

569


What are the 5 oop principles?

598


What is encapsulation in oops?

534


class CTest { public: void someMethod() { int nCount = 0; cout << "This is some method --> " << nCount; } }; int main() { CTest *pctest; pctest->someMethod(); return 0; } It will executes the someMethod() and displays the value too. how is it possible with our creating memory for the class . i think iam not creating object for the class. Thanks in Advance... Prakash

1696


any one please tell me the purpose of operator overloading

1965


to find out the minimum of two integer number of two different classes using friend function

1639


What do you mean by abstraction?

609


Write a program to sort the number with different sorts in one program ??

1914


design a c++ class for the chess board,provide a c++ class definition for such class(only class definition is required)

6145


#include #include #include #include void insert(char *items, int count); int main(void) { char s[255]; printf("Enter a string:"); gets(s); insert(s, strlen(s)); printf("The sorted string is: %s.\n", s); getch(); return 0; } void insert(char *items, int count) { register int a, b; char t; for(a=1; a < count; ++a) { t = items[a]; for(b=a-1; (b >= 0) && (t < items[b]); b--) items[b+1] = items[b]; items[b+1] = t; } } design an algorithm for Insertion Sort

2164