Starting from:

$30

CSE165-Lab 6 Solved

1. Create a class (say myClass) containing both a const (say float f1) and a non-const (say const float f2) float. Initialize f1 and f2 using the constructor initializer list

 

a.  No output is needed.  

b.  Just ensure that your code will (1) instantiate you-defined-class in main() and (2) use the constructor initializer list to initialize the above-mentioned const and non-const floats.  

 

2. Create a header file (say myHeader1.h) containing a namespace (say myNamespace). Inside the namespace create two function declarations (say fun1 and fun2). Now create a second header file (say myHeader2.h) that includes the first one (i.e., include “myHeader1.h”) and continues the namespace, adding two more function declarations (say fun3 and fun4). Now create a cpp file (say main.cpp) that includes the second header file (i.e., include “myHeader2.h”). Inside a function definition (say test1) in main.cpp, call fun1 and fun2 using a scope resolution operator. Inside a separate function definition (say test2) in main.cpp, call fun3 and fun4 using a using directive to your namespace. Inside main(), call test1 and test2.  

 

a.  I changed the problem description a bit to make it more actionable.  

b.  fun1, fun2, fun3, fun4, test1, and test2 don’t need to take any arguments and return any values. 

c.  No output is needed. Just ensure that your program will run smoothly. 

More products