




















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





















Student Student::setRollNo(int aNo){
… return *this; } Student Student::setName(char *aName){
… return *this; }
int
main() {
Student
aStudent;
Student
bStudent;
bStudent
=
aStudent.setName(“Ahmad”);
… bStudent
=
aStudent.setName(“Ali”).setRollNo(2);
return
0;
}
►
float getX()float getY()void setNumber
(float i, float j) float xfloat y Old implementationComplex
float getX()float getY()void setNumber
(float i, float j) float zfloat theta NewimplementationComplex
class Complex{ //new
float z;float theta; public:
void setNumber(float i, float j){
theta = arctan(j/i);…
} … };
class Student{
int rollNo; public:
void setRollNo(int aRollNo);int getRollNo();… };
#include “student.h”void Student::setRollNo(int aNo){
} int Student::getRollNo(){… }
“read-only”