CS304"Object Oriented Programming"

Only Solved

Mega Collection For Final

u can download from given below...

Views: 1836

Attachments:

Replies to This Discussion

In word doc...

Attachments:

Subjective...

Attachments:

More in zip...

Attachments:



Write C++ code for the Copy constructor of following template Vector class.

template< class T >
class Vector {
private:
    T* ptr;
    int size;
    int index;
public:
       Vector( const Vector< T >& );     // copy constructor
        
};

****************************************************

Write a C++ code for student class which shows how exceptions are thrown in initialization list.

**************************************************

Write a C++ code for function which performs case sensitive comparison of two strings.
Hint: You can also use built-in function/s of string class.





****************************************************

Consider the code below,

#include <iostream>
#include <stdlib.h>
using namespace std;
class Shape{
        public:
        void Draw(){cout"shape"endl;}
    };
class Line : public Shape{
        public:
        void Draw(){cout"Line"endl;}
        };
class Circle : public Shape{
        public:
        void Draw(){cout"Circle"endl;}
        };
int main(int argc, char *argv[])
{
  Shape * ptr1 = new Shape();
  Shape * ptr2 = new Line();
  Shape * ptr3 = new Circle();
 
  ptr1->Draw();
  ptr2->Draw();
  ptr3->Draw();
  system("PAUSE");    
  return 0;
}

This code shows output,

Shape
Shape
Shape

Suppose we want to show the output,

Shape
Line
Circle

How we can change the code to do that?

*****************************************************

What is Graceful Termination method of Error Handling? Give its example using C++ code.

****************************************************

Consider the following code:

class Base{
public:
void base();
};

class Derived: public Base{
public:
void derived();
};

int main(){
Derived * derived = new Derived();
return 0;
}

Write the names of member functions of Base and Derived classes that can be accessed using the derived pointer indicated in bold.

*****************************************************

What will be the output of the code given below?

#include <iostream.h>
#include <stdlib.h>

using namespace std;

template <typename T>
class MyClass{
    
    public:
        MyClass(){
            cout"This is class1"endl;
            
            }
    
    };
template <typename T>    
class MyClass<T*>{
    
    public:
        MyClass(){
            cout"This is class2"endl;
            }
    };
template <>    
class MyClass<int>{
    public:
        MyClass(){
            cout"This is class3"endl;
            }
    };

int main(int argc, char *argv[])
{
  MyClass<int> c1;
  MyClass<char*> c2;
  MyClass<float> c3;
  system("PAUSE");    
  return 0;
}

**********************************************

What will be the output after executing the following code?

class c1{
public:
virtual void function(){
cout”I am in c1”endl;
}


};
class c2: public c1{
public:
void function(){
cout”I am in c2”endl;

}

};
class c3: public c1 {
public:
void function(){
cout”I am in c3”endl;
}

};

int main(){

c1 * test1 = new c2();
c1 * test2 = new c3();
test1->function();
test2->function();
system(“PAUSE”);
return 0;
}


**************************************************

What are the non-type parameters for templates?


*****************************************

Suppose Person class is an abstract class; which has some specific features. Briefly describe the important features of abstract class.


*******************************************

What do you mean by Stack unwinding?

***************************************
Explain the difference in operation between these two statements.
person p1(p0);
person p1 = p0;

****************************************

RSS

Discussion Forum

Assignment 1 CS 304, Due date 15 May 2019

Started by muhammad nadeem raza.
Last reply
by + caмe4ѕтυdιeѕ May 14. 1 Reply

cs304 assignment 1 fall 2018

Started by S@@M.
Last reply
by hidayat ullah Dec 5, 2018. 1 Reply

CS304 GDB Last Date: 26 Jan, 2018

Started by + caмe4ѕтυdιeѕ.
Last reply
by +.ïɳnόϲϵᴎԎ ɖόІІ.+ Jan 26, 2018. 5 Replies

CS304 Midterm Papers from 9 to 20 December, 2017

Started by + caмe4ѕтυdιeѕ.
Last reply
by Cute S@mra Dec 19, 2017. 6 Replies

cs 304 assignment 2 solution fall 2017

Started by ++Faheem Khawaja.
Last reply
by +" Heaven Scent "+ Nov 23, 2017. 4 Replies

SPONSORED LINKS

© 2019   Created by Muhammad Anwar Tahseen.   Powered by

Badges  |  Report an Issue  |  Terms of Service