Professional Documents
Culture Documents
Onstructor & Destructors
Onstructor & Destructors
Onstructor & Destructors
Q.2 Write a program to find the sum of odd and even numbers. Use
constructor to initialize data member and destructor to release memory.
Private Members:
OCode of type string
Otype of type string
OSize of type integer
Ofabric of type integer
Oprice of type float
A function InitPrice( ) which calculates and assigns the value of Oprice as
follows:
For the value of OFabric “DNIM”,
Otype Oprice (Rs)
Trouser 1300
Jacket 1400
For Ofabric other than “DNIM” the above mentioned
OPrice gets reduced 30%.
Public Members
A constructor to assign initial values of Ocode, Otype and Ofabric with the
word the “NOT ALLOWED” and Osize and Oprice with 0.
A function Input( ) to input the values of the data member Ocode, Otype ,
Osize and Ofabric and Invoke( ) the InitPrice( ) function.
A function Display( ) which displays the content of the all the data
members for an Outfit.
Question 4:
Write a C++ program to perform various operations on string class
without using language supported built in string function. The operation on
a class are:
i) Read a string
ii) Display the sting
iii) Reverse the string
iv) Copy the string into an empty string
v) Concatenate two string.
B.TECH. ADMISSION CALENDAR
December 14,
Date of Advertisement
2009
• Applications will be issued from 14th December 2009 to 20th February 2010.
• Application Form and Information Brochure can be procured from the following Post
Offices against cash payment of Rs.750/- (Rupees Seven Fifty Only)
INDIA POST
State: Delhi
Sl. No. Name of the Post Office Status GPO/HO/SO Pincode