private Questions
4
Are private interfaces ever used in design decisions ? If so, what are the reasons and when do you know the need for a private interface?
Locomotive asked 1/1, 2011 at 9:55
32
Solved
I'm building a class library that will have some public & private methods. I want to be able to unit test the private methods (mostly while developing, but also it could be useful for future re...
Paule asked 30/10, 2008 at 15:49
5
Solved
I know it is not a good coding practice to declare a method as private in an abstract class. Even though we cannot create an instance of an abstract class, why is the private access modifier availa...
Fotina asked 26/7, 2010 at 11:30
20
Solved
If a variable is declared as public static varName;, then I can access it from anywhere as ClassName.varName. I am also aware that static members are shared by all instances of a class and are not ...
21
Solved
This is an interview question.
Does subclasses inherit private
fields?
I answered "No", because we can't access them using the "normal OOP way". But the interviewer thinks that they are inher...
Egan asked 17/1, 2011 at 17:34
2
Solved
I have newest google chrome currently version 80.0.3987.87. I copied example from JS docs which is
class ClassWithPrivateMethod {
#privateMethod() {
return 'hello world'
}
getPrivate...
Equiprobable asked 5/2, 2020 at 15:20
11
Solved
According to http://www.faqs.org/docs/diveintopython/fileinfo_private.html:
Like most languages, Python has the
concept of private elements:
Private
functions, which can't be called from
outside ...
4
Solved
I read this question, but it still doesn't make a lot of sense to me. It still sounds more like a sugarcoating feature.
What's the difference between:
class A
{
// public/private ?
A (const A&a...
Singspiel asked 17/9, 2013 at 10:55
7
Solved
Coming from a C++ background, this came as a surprise to me. In C++ it's good practice to make virtual functions private. From http://www.gotw.ca/publications/mill18.htm: "Guideline #2: Prefer...
4
Solved
8
Solved
This is a rather basic OO question, but one that's been bugging me for some time.
I tend to avoid using the 'private' visibility modifier for my fields and methods in favor of protected.
This is ...
Supinator asked 6/2, 2011 at 11:36
8
I follow Slack bot post message documents
it works perfectly when post to public channel, but get error [error] => channel_not_found when post to private channel, I even change channel_name to c...
6
Solved
Can I set a private property via reflection?
public abstract class Entity
{
private int _id;
private DateTime? _createdOn;
public virtual T Id
{
get { return _id; }
private set { ChangePrope...
Walrus asked 14/10, 2009 at 11:37
6
Solved
I had to switch my public Github repository to private and cannot access files, not with access tokens that I was able to with the public Github repo.
I can access my private repo's CSV with curl...
19
Solved
What is the difference between private and protected members in C++ classes?
I understand from best practice conventions that variables and functions which are not called outside the class should b...
2
just want to ask a quick question;
Essentially, I want to know if it's possible to hide Python class private methods from the list of suggestions that Visual Studio Code or other IDEs provide.
For ...
Uproar asked 12/1, 2022 at 0:54
2
I'm relatively new to Python so I hope I haven't missed something, but here goes...
I'm trying to write a Python module, and I'd like to create a class with a "private" attribute that can (or mayb...
Horatius asked 2/5, 2014 at 15:57
8
Solved
In C++, I can't think of a case in which I would like to inherit private/protected from a
base class:
class Base;
class Derived1 : private Base;
class Derived2 : protected Base;
Is it really us...
Prototrophic asked 17/12, 2008 at 12:29
2
Solved
I am working on a basic shell interpreter to familiarize myself with Rust. While working on the table for storing suspended jobs in the shell, I have gotten stuck at the following compiler error me...
Analytic asked 8/6, 2014 at 21:22
14
Solved
I have a poorly designed class in a 3rd-party JAR and I need to access one of its private fields. For example,
why should I need to choose private field is it necessary?
class IWasDesignedPoorly {...
Cabochon asked 28/7, 2009 at 19:20
6
Solved
I have learned that I can never access a private variable, only with a get-function in the class. But then why can I access it in the copy constructor?
Example:
Field::Field(const Field& f)
{...
Deed asked 7/11, 2010 at 8:30
5
Solved
Eslint will not recognize private fields marked with # in class declarations, even though I'm using NodeJS version 12 (which supports them).
I am running NodeJS v12.7.0. I have searched all DuckDuc...
Collative asked 6/8, 2019 at 23:17
1
Solved
I find myself trying to use decorators with the native javascript private properties (#) and these first 'recognize' that are in use do not work.
I identified this by using the class-validator deco...
Beliabelial asked 29/10, 2021 at 21:36
7
Solved
Members of a class are by default private in c++.
Hence, I wonder whether there is any possible use of creating a class that has all its members (variables and functions) set by default to privat...
Momently asked 11/9, 2014 at 10:27
2
Solved
Are private getters/setters planned to be supported in JavaScript?
class Next {
#private = 0
get #computed() { // SyntaxError: Unexpected token (
return this.#private + 1
}
}
...
Missi asked 26/4, 2019 at 11:4
© 2022 - 2025 — McMap. All rights reserved.