OBJECT ORIENTED PROGRAMMING CIS 3100

The constructor can be called by two ways they are by

This preview shows 9 out of 12 pages.

The constructor can be called by two ways. They are, • By calling the constructor explicitly e.g., integer int1 = integer (0, 100); • By calling the constructor implicitly e.g., integer int1 (0, 100); 64. State dynamic initialization of objects. Class objects can be initialized dynamically. The initial values of an object may be provided during run time. The advantage of dynamic initialization is that various initialization formats can be used. It provides flexibility of using different data formats. 65. Define Destructor. (April/May 2011) A destructor is used to destroy the objects that have been created by a constructor. It is a special member function whose name is same as the class and is preceded by a tilde ‘~’ symbol. 66. Give the general form of an operator function. The general form of an operator function is given as, return-type class-name :: operator op (arglist) { function body }
Image of page 9

Subscribe to view the full document.

Where, Return-type -> type of value returned operator -> keyword op -> operator being overloaded 67. List some of the rules for operator overloading. (April/May 2011) (Nov/Dec 2011) • Only existing operators can be overloaded. • We cannot change the basic meaning of an operator. • The overloaded operator must have at least one operand. • Overloaded operators follow the syntax rules of the original operators. Some operators can not be overloaded such as ::,sizeof, - > 68. What are the types of type conversions? There are three types of conversions. They are • Conversion from basic type to class type – done using constructor • Conversion from class type to basic type – done using a casting operator • Conversion from one class type to another – done using constructor or casting operator 69. What are the conditions should a casting operator satisfy? The conditions that a casting operator should satisfy are, • It must be a class member. • It must not specify a return type. • It must not have any arguments. 70. What are the types of inheritance? The various types of inheritance are, • Single inheritance • Multi-level inheritance • Multiple inheritance • Hierarchical inheritance • Hybrid inheritance 71. Give the syntax for inheritance. The syntax of deriving a new class from an already existing class is given by, class derived-class : visibility-mode base-class { body of derived class } 72. Define single inheritance. In single inheritance, one class is derived from an already existing base class. Here A is the base class and B is the derived class. 73. Define multi-level inheritance. In multi-level inheritance, a new class is derived from a class already derived from the base class. Here, class B is derived from class A and class C is further derived from the derived class B. 74. Define multiple inheritance. A B A B C
Image of page 10
In multiple inheritance, a single class is derived from more than one base class.
Image of page 11

Subscribe to view the full document.

Image of page 12
You've reached the end of this preview.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern