title: How can I access the class variables inside the print() function here?
body: <p>Book.h</p>
  <pre><code>class Book{
  private:
      std::string title;
      std::string author;
      int callNo;
  public:
      Book(std::string title,std::string author,int callNo);
      void print();
  
  };
  </code></pre>
  <p>Book.cpp</p>
  <pre><code>Book::Book(string title,string author,int callNo){
      this-&gt;title=title;
      this-&gt;author=author;
      this-&gt;callNo=callNo;
  }
  
  void print(){
      cout&lt;&lt;&quot;Title: &quot;&lt;&lt;title&lt;&lt;endl;
      cout&lt;&lt;&quot;Author: &quot;&lt;&lt;author&lt;&lt;endl;
      cout&lt;&lt;&quot;Call Number: &quot;&lt;&lt;callNo&lt;&lt;endl;
  }
  </code></pre>
  <p>When compiling, I get the error:</p>
  <p>Book.cpp:14:19: error: ‘title’ was not declared in this scope
  cout&lt;&lt;&quot;Title: &quot;&lt;&lt;title&lt;&lt;endl;</p>
  <p>Is there anyway of calling the class variables without changing the parameters of print()?</p>