Can’t access public property [closed]

I’ve set public property and define it in construct as following :

<?php

use AppModelsPlan;

class ClassB extends Base
{
    public $plan;

    public function __construct()
    {
        $this->plan = new Plan();
    }

    public function viewPlan()
    {
        View::renderTemplate('Plans/view.html', [
        'view' => $plan->getPlans()
        ]);
    }
}

But it says ‘Message: ‘Undefined variable $plan’ !

When I use this instead it’s work !

'view' => $this->plan->getPlans()

Please note I’m using this code in a controller file ( twig ).

Thanks in advance.