1.explicit call for destructor
2.calling function inside a constructor.
3.base *b-new derived
delete b;
4.delete p what it will delete.
5.size of base class and derived class int i,in base class
and int j in derived.
6.int i-20
int main()
{

int i =5;
printf("%d".::i);

{

int i =10;
printf("%d".::i);

}
}
7.object slicing
8.new
9.function overloading(return type).
10.class base()
{

virtuval fun()
{
-----
}
}

class derivied:public base()
{
fun()
{
-----
}
}
int main()
{
derived d;

}

11.how static function will call in C++?

12.default structures are in C++?
13.constructors should be in public .
14.virtuval constructor not exist.
15.multilevel inhritence. destructor order.

Answer Posted / achal ubbott

OK! this is a set of questions. Let me see how far can I go.

1. destructor of a class can be called explicitly as
follows using the object of the class.

sample * p = new sample(/*some arguments*/);
p->~sample(); // explicit call;

3. correct order of destructor call is ~derived() and then
~base().
in case you haven't declared the destructor of base as
virtual then delete base; would cause problems.

cheers

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

write a code for this. serial_number contained in the header of the file will be read , if this serial number is less than a previous serial number within a successfully processed file, or is the same as another serial number within a successfully processed file, or if the field contains anything other than 7 digits, then the file must error with the reason ‘Invalid SERIAL_NUMBER’.

1770


What are the 4 main oop principles?

669


What is overloading in oop?

568


Write a program to implement OOPS concepts such as inheritance, polymorphism, friend function, operator overloading?

4231


What is data binding in oops?

574






What is constructor overloading in oop?

597


Plese get me a perfect C++ program for railway/airway reservation with all details.

3419


What is encapsulation process?

573


Whats is abstraction in oops?

585


What is oops with example?

559


Is react oop?

605


What is difference between data abstraction and encapsulation?

608


What is polymorphism and example?

585


Can an interface inherit a class?

551


Write a program to compute for numeric grades for a course. The course records are in a file that will serve as the input file. The input file is in exactly the following format: Each line contains a student's first name, then one space, then ten quiz scores all on one line. The quiz scores are in whole number and are separated by one space. Your program will take it input from this file and sends it output to a second file. The data in the output file will be exactly the same as the data in the input file except that there will be one additional number (of type double) at the end of each line. This number will be the average of the student's ten quiz scores. Use at least one function that has file streams as all or some of its arguments.

2565