access-specifier Questions
3
I have been going through the recent swift docs and working out on few examples in understanding private and fileprivate keywords in swift4. I am trying to access a fileprivate and private variable...
Wintery asked 31/10, 2017 at 11:9
8
Solved
Other than self.class.send :method, args..., of course. I'd like to make a rather complex method available at both the class and instance level without duplicating the code.
UPDATE:
@Jonathan ...
Antung asked 21/8, 2008 at 18:2
17
Solved
What is the difference between public, private, and protected inheritance in C++?
Proline asked 13/5, 2009 at 20:47
6
What is the advantage of making a private method virtual in C++?
I have noticed this in an open source C++ project:
class HTMLDocument : public Document, public CachedResourceClient {
private:
v...
Wentzel asked 31/1, 2010 at 5:39
8
Solved
class Example
private
def example_test
puts 'Hello'
end
end
e = Example.new
e.example_test
This of course will not work, because we specified explicit receiver - instance of Example (e), and...
Abaxial asked 27/11, 2010 at 18:34
3
Solved
Ruby doesn't seem to have a facility for defining a protected/private block like so:
protected do
def method
end
end
This would be nice compared to
protected
def method
end
public
wher...
Zetta asked 15/6, 2009 at 1:48
8
Can Qt signals be public, protected or private? Can I create internal signals, which are seen only inside the class?
Update: I have a class with some internal signals. How can I make those signals ...
Harlotry asked 26/1, 2010 at 22:32
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
8
Solved
Before I read this article, I thought access control in Ruby worked like this:
public - can be accessed by any object (e.g. Obj.new.public_method)
protected - can only be accessed from within the...
Houseyhousey asked 20/8, 2010 at 20:1
10
Solved
I have a two part question
Best-Practice
I have an algorithm that performs some operation on a data structure using the public interface
It is currently a module with numerous static methods, al...
Vina asked 25/11, 2008 at 21:1
6
Solved
I was trying to learn java and when I went through access specifiers I had a doubt. What is the difference between the default one if none is specified and the protected access specifier in j...
Thumbscrew asked 26/3, 2012 at 7:8
7
Solved
What is the reason of declaring a member of a private inner class public in Java if it still can't be accessed outside of containing class? Or can it?
public class DataStructure {
// ...
privat...
Langmuir asked 7/6, 2011 at 11:42
9
Solved
In Java, are access specifiers and access modifiers the same thing?
Hamel asked 10/2, 2010 at 17:2
7
Solved
How come this approach of creating a private class method works:
class Person
def self.get_name
persons_name
end
class << self
private
def persons_name
"Sam"
end
end
end
puts "...
Vexation asked 10/2, 2011 at 3:10
10
Solved
This article has been helpful in understanding the new access specifiers in Swift 3. It also gives some examples of different usages of fileprivate and private.
My question is - isn't using filep...
Ledeen asked 18/8, 2016 at 20:49
3
Solved
Given a class with a couple of instance variables and some methods. Some instance variables are set accessible via attr_reader and attr_accessor. Thus the others are private.
Some of the private in...
Terminator asked 27/1, 2012 at 18:50
12
Solved
I just started reading a Java book and wondered; which access specifier is the default one, if none is specified?
Kynewulf asked 20/8, 2010 at 10:35
3
Solved
I am getting main.java: error: someId in someStruct is defined in an inaccessible class or interface but how can I solve this?
my main class:
import subdir.Subclass;
public class main{
...
...
Briarwood asked 3/2, 2014 at 19:40
9
What is the difference between access specifier protected and internal protected in C# ?
Pythagorean asked 17/8, 2010 at 7:40
3
Solved
In the Java tutorial "Defining an Interface", it says
If you do not specify that the interface is public, your interface will be accessible only to classes defined in the same package as the in...
Caracalla asked 26/1, 2011 at 5:30
4
Solved
We all know members specified protected from a base class can only be accessed from a derived class own instance. This is a feature from the Standard, and this has been discussed on Stack Overflow ...
Talanta asked 29/3, 2018 at 7:48
12
I know that an interface must be public. However, I don't want that.
I want my implemented methods to only be accessible from their own package, so I want my implemented methods to be protected.
...
Vaientina asked 8/1, 2009 at 2:21
3
Solved
class A
private
def initialize
puts "wtf?"
end
end
A.new #still works and calls initialize
and
class A
private
def self.new
super.new
end
end
doesn't work altogether
So what's the corr...
Tincture asked 14/10, 2009 at 16:18
3
Solved
We all know that if we don't specifically define a constructor, the compiler inserts an invisible zero-parameter constructor. I thought its access modifier was public, but in dealing with an inner ...
Cathryncathy asked 25/2, 2014 at 7:14
7
I'm learning Ruby, and have come up to a point where I am confused.
The book I am using is talking about private, public, and protected methods, but I am still a bit confused. What are the differe...
Monophonic asked 27/3, 2012 at 2:54
1 Next >
© 2022 - 2025 — McMap. All rights reserved.