title: C++ variables not changing as intended
body: <p>I'm currently working on an object oriented project for C++ programming.
  I have created a few objects:</p>
  
  <pre><code>int main()
  {
      Address address1 = Address("7732","cambie street","vancouver","BC","v5p3r3");
      Author author1 = Author("Joe","Howe","joehow@hotmail.ca");
      Publisher publisher1("candy",address1);
      Book book1 = Book("sprite",author1,publisher1,"1995");
   return 0;
  }
  </code></pre>
  
  <p>and here are my 4 object constructors</p>
  
  <pre><code>Address::Address(string number, string name, string c, string crty, string pCode){
      streetNumber = number;
      streetName = name;
      city = c;
      country = crty;
      postalCode = pCode;
  }
  Book::Book(string newTitle, Author author1,Publisher pub, string y){
      ISBN++;
      bookISBN = ISBN;
      title = newTitle;
      a = author1;
      authorCount = 1;
      d = pub;
      year = y;
  }
  Author::Author(string fN, string lN, string e){
  
      firstName = fN;
      lastName = lN;
      email = e;
  }
  Publisher::Publisher(string n, Address x){
      name = n;
      a = x;
  }
  </code></pre>
  
  <p>when i call these functions in the main</p>
  
  <pre><code>cout &lt;&lt; book1.getPublisher().getAddress().getCity() &lt;&lt; endl;
  book1.getPublisher().getAddress().set("washington",Address::CITY);
  cout &lt;&lt; book1.getPublisher().getAddress().getCity() &lt;&lt; endl;
  </code></pre>
  
  <p>not sure if these are allowed in c++ i've done them in java, </p>
  
  <p>i've also tried separating them and it would give me the desired results, </p>
  
  <p>so my question becomes is this format allowed in c++ and if so what am i doing wrong.</p>
  
  <p>my result displays</p>
  
  <pre><code>vancouver
  vancouver
  </code></pre>
  
  <p>but my desired result would be</p>
  
  <pre><code>vancouver
  washington
  </code></pre>
  
  <p>these are my get/set functions</p>
  
  <pre><code>Address Publisher::getAddress(){
      return a;
  }
  
  
  Publisher Book::getPublisher(){
      return d;
  }
  void Address::set(string value , int number){
  switch(number)
  {
      case STREET_NUMBER:
          streetNumber = value;break;
      case STREET_NAME:
          streetName = value;break;
      case CITY:
          city = value;break;
      case COUNTRY:
          country = value;break;
      case POSTAL_CODE:
          postalCode = value;break;
  
  
    }
  }
  </code></pre>
  
  <p>Thanks for the help</p>