title: Salesforce - Invalid constructor name error
body: <p>I'm building a controller to show the data from a custom object on a Visualforce page. Here's my class:</p>
  
  <pre><code>public class myController {
  
      Opportunity opp;
      list&lt;Leg__c&gt; legs;
  
      public Opportunity getOpp() {
          if(opp == null)
              opp = [select name, Primary_Contact__r.name, Primary_Contact__r.email, Primary_Contact__r.phone from Opportunity
                  where id = :ApexPages.currentPage().getParameters().get('id')];
          return opp;
      }
      public getLegs() {
          legs = [select Departure__c, Arrival__c from Leg__c
                  where Opportunity__c = :ApexPages.currentPage().getParameters().get('id')];
      }
  
  }
  </code></pre>
  
  <p>I can't get it to compile! I keep getting </p>
  
  <blockquote>
    <p>Error: myController Compile Error: Invalid constructor name: getLegs at line 12 column 12  </p>
  </blockquote>
  
  <p>What am I doing wrong, and how can this be solved?</p>