Accessing variables in ancestor classes

Topics: Language Specification
Dec 31, 2012 at 6:28 PM

In the code example below, Is there any way for the bar class to access the x variable in the foo class without making it public?  In other languages, declaring x protected would accomplish this.

 

 

class foo {
    private x;
}

class bar extends foo {
    y = x;
}

 

 

Coordinator
Jan 3, 2013 at 4:05 PM

There currently isn't support for protected, but we've talked about supporting it after 1.0 is released as we continue to make the language richer and more expressive.  Here's the issue tracker for 'protected': http://typescript.codeplex.com/workitem/125