POO Handout - Lab 4 PDF
POO Handout - Lab 4 PDF
s1.print();
s2->print();
Student s3(21);
s3.print();
s4->print();
void print(){
cout<<"Name: "<<this->name<<endl;
cout<<"Adress: "<<this->address<<endl;
cout<<"Age: "<<this->age<<endl;
}
~Student(){
if(this->name!=NULL){
delete[] this->name;
}
}
};
Student s3("Ion
Popescu","Romana, No 7",23);
s3.print();
How many times is the destructor called at the end of the above program?
strcpy(this->name, v_name);
strcpy(this->address, v_address);
}
void print(){
cout<<"Name: "<<this->name<<endl;
cout<<"Adress: "<<this->address<<endl;
cout<<"Age: "<<this->age<<endl;
}
~Student(){
if(this->name!=NULL){
delete[] this->name;
}
}
};
How many times is the destructor called at the end of the above program?