private

Private members when extending a class using ExtJS

风格不统一 提交于 2019-12-02 15:19:17
I have done some research on the ExtJS forum regarding private methods and fields inside a extended class , and I couldn't find any real answer to this. And when I say an extended class I mean something like this: Ext.ux.MyExtendedClass = Ext.extend(Ext.util.Observable, { publicVar1: 'Variable visible from outside this class', constructor: function(config) { this.addEvents("fired"); this.listeners = config.listeners; }, // to show that I need to use the base class publicMethod1: function() { return 'Method which can be called form everywhere'; }, publicMethod2: function() { return this

NSTokenField catch some NSEvents

折月煮酒 提交于 2019-12-02 09:28:08
I need implement Command + Enter, Command + O and Esc shotcuts for NSTokenField and solutonns like https://stackoverflow.com/a/18486965/1067147 not worked because -(void)noop:(SEL)sel isn't useful. My way is to create category for upper-in-hierarchy class NSView (also I try it for NSTextView but no luck): // NSView+WideInterpreter.h #import <Cocoa/Cocoa.h> #define kNotificationTokenModifier @"kNotificationTokenModifier" #define kNotificationTokenModifier_modifier @"kNotificationTokenModifier_modifier" typedef enum{ BMTokenModifier_CommandEnter = 10, BMTokenModifier_CommandO, BMTokenModifier

Ada: Understanding private types and understanding packaging

天涯浪子 提交于 2019-12-02 05:51:03
问题 I am trying to learn how to use private declarations in Ada and also to understand packaging. I have tried to keep my codes as short as possible. We start with the main file rectangular_Form.ads with Rectangular_Method_1; package Rectangular_Form renames Rectangular_Method_1; -- with Rectangular_Method_2; -- package Rectangular_Form renames Rectangular_Method_2; This tells us that we can have two implementations and that for now Rectangular_Method_1 has been chosen. Then we have the

Java Override a private function Dont showing polymorphic behaviour

▼魔方 西西 提交于 2019-12-02 05:10:09
问题 public class Shape { final private void print() { System.out.println("in class Shape"); } public static void main(String[] args) { Shape shape=new Rectangle(); shape.print(); //calling shape class function //giving output in class shape } } public class Rectangle extends Shape { public void print() { System.out.println("in class Rectangle"); //super.print(); } } Ques: why private function don't show polymorphic behaviour ? and we are still overriding final method? its calling base class

Best Practice on local use of Private Field x Property

爱⌒轻易说出口 提交于 2019-12-02 04:52:36
问题 When inside a class you have a private fiels and expose that field on a public property, which one should I use from inside the class? Below you is an example on what I am trying to find out. Should manioulate the Private Field _Counter or the Property Counter? Public Class Test Private _Counter As Integer Public Property Counter() As Integer Get Return _Counter End Get Set(ByVal value As Integer) _Counter = value End Set End Property Private Sub Dosomething() 'What is the best practice?

Best Practice on local use of Private Field x Property

帅比萌擦擦* 提交于 2019-12-02 02:18:42
When inside a class you have a private fiels and expose that field on a public property, which one should I use from inside the class? Below you is an example on what I am trying to find out. Should manioulate the Private Field _Counter or the Property Counter? Public Class Test Private _Counter As Integer Public Property Counter() As Integer Get Return _Counter End Get Set(ByVal value As Integer) _Counter = value End Set End Property Private Sub Dosomething() 'What is the best practice? 'Direct access to private field or property? 'On SET _Counter += 1 'OR Me.Counter += 1 'On Get Console

Java - Difference between private and package-private enum constructor [duplicate]

余生长醉 提交于 2019-12-02 02:14:32
This question already has an answer here: Why can a enum have a package-private constructor? 2 answers Recently I'm quite oftenly using Enumerations. So I wonder... Is there any difference between a private Enum constructor and a enum constructor withour any visibility modifier (package-private)? According to java docs The constructor for an enum type must be package-private or private access. but Accroding to the JLS If no access modifier is specified for the constructor of an enum type, the constructor is private. So there no difference between the package-private and private . The

Ada: Understanding private types and understanding packaging

痴心易碎 提交于 2019-12-02 00:01:37
I am trying to learn how to use private declarations in Ada and also to understand packaging. I have tried to keep my codes as short as possible. We start with the main file rectangular_Form.ads with Rectangular_Method_1; package Rectangular_Form renames Rectangular_Method_1; -- with Rectangular_Method_2; -- package Rectangular_Form renames Rectangular_Method_2; This tells us that we can have two implementations and that for now Rectangular_Method_1 has been chosen. Then we have the specifications file Rectangular_Method_1.ads : package Rectangular_Method_1 is type Rectangular is private;

labeling a group of members as private/public in c#

情到浓时终转凉″ 提交于 2019-12-01 22:18:57
问题 in a c++ class declaration, you can label a group of members as private or public, e.g. private: int x; double y; seems like there's no way to do this in c#. am I wrong? 回答1: No, you can't not do this in C#. At best, you can use the default visibility for members, which is private, and not use private, but for public, you have to indicate it for all members. 回答2: You're correct. Although, if you leave visibility keyword off altogether, a member defaults to private. 回答3: No you're not wrong.

Access to private field of a super class

本小妞迷上赌 提交于 2019-12-01 22:05:30
As everyone knows, private fields are not inherited between classes. What intrigues me, is how it works for inner static classes. Consider the following code: public class Main { public static void main(String[] args) { new B(); } private static class A { private int a = 10; private void foo() { System.out.println("A.foo"); } } private static class B extends A { { // foo(); // compile-time error super.foo(); // ok // System.out.println(a); // compile-time error System.out.println(super.a); // ok } } } Can you please explain how it is possible to access private fields of other inner class? And