Constructor & Destructor (SET - 1)
Constructor & Destructor (SET - 1)
[SET 1]
1
Answer the questions (i) and (iii) after going through the
following class:
class Seminar
{
int time;
public:
Seminar()
//Function 1
{
time = 30;
cout << "Seminar starts now" << endl;
}
void lecture()
//Function 2
{
cout << "Lectures in the seminar on" <<
endl;
}
Seminar(int duration)
//Function 3
{
time = duration;
cout << "Seminar starts now" << endl;
}
};
~Seminar()
//Function 4
{
cout << "Thanks" << endl;
}
Answer the questions (i) and (ii) after going through the
following class:
class Test
{
char paper[20];
int marks;
public:
Test ()
// Function 1
{
strcpy (paper, "Computer");
marks = 0;
}
Test (char p[])
// Function 2
{
strcpy(paper, p);
marks = 0;
}
Test (int m)
// Function 3
{
strcpy(paper,"Computer");
marks = m;
}
};
// Function 4