Answer to Question #174883 in C++ for Kaviyan P

Question #174883

Create the class Student consisting of data members register_no and name. Define array of objects by using constructor Student() to assign the values for the class Student data members, display() member function is used to display the information of student. Finally free the resources of data objects using destructor member function. (Note: Define object size of two)


1
Expert's answer
2021-03-27T16:37:07-0400
#include<iostream>
#include<string>
using namespace std;
class Student
{
 public:
    int register_no;
    string name;


    Student()
    {
        register_no=0;
        name="null";
    }
    void display()
    {
        cout<<"\nRegister number "<<register_no;
        cout<<"\nName "<<name;
    }
    ~Student();
}s1[2];
Student::~Student()
{
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS