1

Click here to load reader

Final assignments

Embed Size (px)

Citation preview

Page 1: Final assignments

1) Define the class in order to meet the following needs

a) MyClass m1;b) MyClass m2(40,56.29f);c) m1.display(m2);d) MyClass m3("hello world");e) MyClass m4=m3;f) int k=MyClass().show();

define destructor with necessary statements inside.

2) define a class "Product", with following members

char *proid;char *prodesc;int price;int qty;

create array of Product for 10 products.Define necessary constructors , functions and destructor inside the class.

3)Define a class "StaticDemo"withprivate -static variablepublic - static function In the main() function, prove that in order to display the value of static variable, no need to create an instance.

4) create a library (vita.lib) to define following classesa) student b) module c) courseIn all the above mentioned classes add member variables and member functions of your choice.

Now create an application to show how will u use above classes.

5) create a library ( mathematics.lib ) in this library create a class "Math"In this class define three functionsa) to accept number and return double of it.b) to accept a number and return square of it.c) to accept a number ,if it is negative, return positive of it.

make sure that while calling all these functions, client need not create an instance of "Math" class.

write application to access "Math" class and all its functions.