can we declare an object of a class in another class?(assume
both class as public classes)
Answer Posted / poonam
yes,we can declare the object of one class into another class. The kind of relationship is called Containership or nesting. this is one of the best feature of c++ which allow inheritence and reusability.
for eg:
class alpha {.....};
class beta {....};
class gamma
{
alpha a;
beta b;
...
};
Creation of one object into another is very different from that of an independent object. Independent object is created
by cnstructors when declared with the arguments.
for further details refer c++ by balguruswamy page no.240
| Is This Answer Correct ? | 13 Yes | 0 No |
Post New Answer View All Answers
How to Split Strings with Regex in Managed C++ Applications?
write a program to convert temperature from fa height into celcius and vise versa,use modular programming
i don't know about working of nested for loop can any one help me
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 total number of disk writes by MySQL.
develop a program to calculate and print body mass index for 200 employees
Given a table of the form: Product Sold on A 1/1/1980 B 1/1/1980 C 1/1/1980 A 1/1/1980 B 1/1/1980 C 2/1/1980 A 2/1/1980 There are 30 products and 10,000 records of such type. Also the month period during which sales happened is given to u. Write the program to display the result as: Product Month No. of copies A January 12 A February 15 A March 27 B January 54 B February 15 B March 10 C January 37
how to take time as input in the format (12:02:13) from user so that controls remains between these columns?
how to diplay a external image of output on winxp by using c & c++,
How can I Draw an ellipse in 3d space and color it by using graph3d?
Teta-Omeg-Big-Oh Show that f(n) = n2 + 3n3 is ;(n3).
What output does the following code generate? Why? What output does it generate if you make A::Foo() a pure virtual function? class A { A() { this->Foo(); } virtual void Foo() { cout << "A::Foo()" << endl; } }; class B : public A { B() { this->Foo(); } virtual void Foo() { cout << "A::Foo()" << endl; } }; int main(int, char**) { A objectA; B objectB; return 0; }
write a program that creates a sequenced array of numbers starting with 1 and alternately add 1 and then 2 to create the text number in the series , as shown below. 1,33,4,6,7,9,............147,148,150 Then , using a binary search , searches the array 100 times using randomly generated targets in the range of 1 to 150
can you please write a program for deadlock that can detect deadlock and to prevent deadlock.
output for printf("printf");
write a function that reverse the elements of an array in place.The function must accept only one pointer value and return void.