hm help Part 1: Implement a Place class as specified: data members: name - name of the Place (dynamic variable) functions: Place(): default constructor set name to “TBD” Place(string): one argument constructor set name accessor - an accessor for the name variable mutator - an mutator for the name variable Part 2: Implement the big three for Place class. Part 3: An operator overload >> function for Place class. An operator overload << function for Place class. Use following main() to test your class. int main() { // part 1 Place a1,a2("Bookstore"); cout<<"a1: "<>c; cout<
hm help
Part 1: Implement a Place class as specified:
data members:
name - name of the Place (dynamic variable)
functions:
Place(): default constructor set name to “TBD”
Place(string): one argument constructor set name
accessor - an accessor for the name variable
mutator - an mutator for the name variable
Part 2: Implement the big three for Place class.
Part 3: An operator overload >> function for Place class.
An operator overload << function for Place class.
Use following main() to test your class.
int main() {
// part 1
Place a1,a2("Bookstore");
cout<<"a1: "<<a1.getName()<<endl; // print "a1: TBD"
a1.setName("Supermarket");
cout<<"a1: "<<a1.getName()<<endl; // print "a1: Supermarket"
cout<<"a2: "<<a2.getName()<<endl; // print "a2: Bookstore"
// part 2
Place b1("Bookstore");
cout<<"b1: "<<b1.getName()<<endl; // print "b1: Bookstore"
Place b2(b1),b3;
cout<<"b2: "<<b2.getName()<<endl; // print "b2: Bookstore"
b2.setName("Supermarket");
cout<<"b1: "<<b1.getName()<<endl; // print "b1: Bookstore"
cout<<"b2: "<<b2.getName()<<endl; // print "b2: Supermarket"
b3 = b2;
cout<<"b1: "<<b1.getName()<<endl; // print "b1: Bookstore"
cout<<"b2: "<<b2.getName()<<endl; // print "b2: Supermarket"
cout<<"b3: "<<b3.getName()<<endl; // print "b3: Supermarket"
b3.setName("School");
cout<<"b1: "<<b1.getName()<<endl; // print "b1: Bookstore"
cout<<"b2: "<<b2.getName()<<endl; // print "b2: Supermarket"
ET580, Quiz 1, Summer 2021
cout<<"b3: "<<b3.getName()<<endl; // print "b3: School"
// part 3
Place c("Bookstore");
cout<<"c: "<<c; // print "c: School"
cin>>c;
cout<<c;
return 0;
}
Step by step
Solved in 2 steps with 8 images