Question
PLEASE HELP ASAP. For this lab, we are going to use a pointer in a class definition. Note: The lab files ( Student.h , and
PLEASE HELP ASAP.
For this lab, we are going to use a pointer in a class definition.
Note: The lab files (Student.h, and lab6.cpp) are available on GL in the directory
After you have copied the files into your lab 6 directory, you should spend some time really looking at the Student.h file.
Use the files that you copied from the class directory as the starting skeleton for your program. It includes comments about what you are going to need to do. You should not need to modify the main function at all.
There are three parts to this lab:
Code Student.cpp. The declaration for the student class is in Student.h. You can see the sample expected output below. You need to implement the constructor, destructor, and Display(). You cannot use a vector in this lab but you can use a dynamically created array.
Write the makefile (instructions are below).
Check for memory leaks using valgrind ./lab6.cpp
Student.h FILE
#ifndef STUDENT_H
#define STUDENT_H
#include
#include
using namespace std;
class Student
{
public:
Student();
~Student();
void Display();
private:
int m_num;
float *m_ptr;
};
#endif
lab6.cpp
#include "Student.h"
#include
#include
using namespace std;
int main() {
Student s;
s.Display();
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started