Lecture 9
Class
// file: student.h
#ifndef STUDENT_H
#define STUDENT_H
struct student {
int assns, mt, final;
float grade(); // forward declaration
};
// file: student.cc
#include "student.h"
float Student::grade() { // veru similar to std::
return this->assns*0.5+this->mt*0.2+this->final*0.4;
}
Student billy {70, 50, 75};
Student billy = {70, 50, 75};
billy.grade();Default Constructor
Last updated