Which keyword is written to use a variable declared in one
class in the other class?
Answers were Sorted based on User's Feedback
Answer / poonam
We can use thses keywords Public ,Internal,Protected Internal, to use a variable in one class to other Class .
| Is This Answer Correct ? | 1 Yes | 0 No |
Write a program to demonstrate the use of 'Composition' in C++
what is polymorphism?
Can you inherit a private class?
is there any choice in opting subjects like 4 out of 7
What is difference between new and malloc?
i got a backdoor offer in process global,Bangalore..Can i work with it?
write a program in c++ to overload the function add (s1,s2) where s1 and s2 are integers and floating point values.
Why do we need oop?
What are the three main types of variables?
#include <stdio.h> #include <alloc.h> #include <stdlib.h> #include <conio.h> void insert(struct btreenode **, int); void inorder(struct btreenode *); struct btreenode { struct btreenode *leftchild; struct btreenode *rightchild; int data; }; main() { struct btreenode *bt; bt=(struct btreenode *)NULL; int req,i=1,num; clrscr(); printf("Enter number of nodes"); scanf("%d",&req); while(i<=req) { printf("Enter element"); scanf("%d",&num); insert(&bt,num); i++; } inorder(bt); } void insert(struct btreenode **sr, int num) { if(*sr==NULL) { *sr=(struct btreenode *)malloc (sizeof(struct btreenode)); (*sr)->leftchild=(struct btreenode *)NULL; (*sr)->rightchild=(struct btreenode *)NULL; (*sr)->data=num; return; } else { if(num < (*sr)->data) insert(&(*sr)->leftchild,num); else insert(&(*sr)->rightchild,num); } return; } void inorder(struct btreenode *sr) { if(sr!=(struct btreenode *)NULL) { inorder(sr->leftchild); printf("\n %d",sr->data); inorder(sr->rightchild); } else return; } please Modify the given program and add two methods for post order and pre order traversals.
i am getting an of the type can not convert int to int *. to overcome this problem what we should do?
How do you make derived class as an abstract class?