Questions tagged [class-visibility]

In certain object-oriented programming languages, such as Java, class visibility determines the level of visibility or of accessibility of a class. For methods' or attributes' visibility, or for a more general tag on access modifiers, you might want to use the tag [access-modifiers].

In certain object-oriented programming languages, such as Java, class visibility determines the level of visibility or of accessibility of a class.

Generally the access modifiers used are: public, private or protected.

A question connected with the visibility of a class in an object-oriented programming language should use this tag.

For methods or attributes visibility, or for a more general tag on access modifiers, you might want to use the tag .

99 questions
1
vote
2 answers

Swift access control on computed properties: why does this work?

I seem to be misunderstanding something about access control modifiers in Swift. Here is my code from a playground: class Something { private (set) var name :String { get { return "" } set {} } } var thing = Something(); thing.name =…
Ian Newson
  • 7,679
  • 2
  • 47
  • 80
1
vote
1 answer

Inheritance and visibility across projects

edit: I only ever used Eclipse to program Java, so all of the following (and all my knowledge on Java) is dependent on how Java is programmed in that environment. I have two eclipse projects: Project A with class X and Project B with class Y. Class…
Manuel
  • 2,143
  • 5
  • 20
  • 22
1
vote
1 answer

Visibility in PHP? context of `$this` when inherited?

I am new to php and I was going through the documentation for the visibility. I am little confused with this example in the documentation. when the call to $myFoo->test() is made, shouldn't it make a call to Foos $this->testPrivate(); . I mean…
level0
  • 323
  • 1
  • 3
  • 13
1
vote
1 answer

Most efficient way of accessing a private variable of another class?

There are many methods around that allow you to access private variables of another class, however what is the most efficient way? For example: I have this class with some details in: class something{ private $details = ['password' =>…
Exhibitioner
  • 123
  • 11
1
vote
0 answers

Design package hierarchy in java, visibility constraints

I have a package ts, containing interfaces for ticket system. I also have hts package, containing concrete implementation of ts. I have TicketSystem.class in ts, and HTicketSystem.class in hts extended from it the first one. HTicketSystem.class is…
Andrey
  • 853
  • 9
  • 27
1
vote
1 answer

How to activate a compose model only when it is visible?

I have a view that contains a composed model. When I upload the page the composed component although it is not visible yet is being activate. What I want is to click on the button "Answer", so then and only then The composed component will be…
Lilac Oren
  • 105
  • 1
  • 7
1
vote
1 answer

How do I avoid opening up my classes too much when using external frameworks?

We have a bunch of MVC and WebAPI projects that use dependency injection to access service classes and other dependencies like that from the controllers in both frameworks. The problem I'm having is that I wanted to make all the services specific to…
julealgon
  • 7,072
  • 3
  • 32
  • 77
1
vote
1 answer

.NET class visibility with more library projects

I have a public class MyClass in a library project A and this project is references by project B which is using the class. Project B is also a library and let's say it's refereced by project C. Is it possible to use MyClass in project C just by…
Dan Dinu
  • 32,492
  • 24
  • 78
  • 114
1
vote
1 answer

Swift and visibility declaration

Can someone give an example about when it would be recommended to use the modifier public in a class and its properties/methods. Coming from Java background, it’s a bit confusing because -If I'm not wrong- the equivalent for public modifier in Java…
Víctor Albertos
  • 8,093
  • 5
  • 43
  • 71
1
vote
3 answers

Using late binding to call a private method from a non private context

I was surprised by the output produced by the piece of code below (g++ 4.4.7). class A { public: virtual void f() {std::cout << "A::f()" << std::endl;} }; class B : public A { private: // Automatically virtual, because of base class …
Vincenzo Pii
  • 18,961
  • 8
  • 39
  • 49
1
vote
1 answer

Menu Items not getting displayed when making nav visible through css media queries

I am having horizontal menu bar which I don't want to display for screens having width < 610 px. For that I am setting my nav tag as : nav{display:none;} Now, I am writing my media query as : @media screen and…
rammurtee
  • 17
  • 1
  • 2
1
vote
2 answers

Javascript way to design inheritance + privacy

I read the book "JavaScript : The Good Parts" book by Douglas Crockford and so many other resources and i'm a bit confused about implementing inheritance AND privacy in Javascript. I'm coming from Java World, I've understood that I can simulate…
1
vote
0 answers

Toggle visibility with jQuery is immediately collapsing

I am a beginner in jQuery and JavaScript. I have the following problem: Every time I try to open an div area it is immediately collapsing. The HTML is:
1
vote
2 answers

Inconsistent accessibility error declaring public class method with internal type (C#)?

I have a JSON class object that is an internal class. I'd like to keep it that way to keep other code from trying to create objects of that type since I only want the JSON deserialization code to do that. I can use the class type as a variable,…
Robert Oschler
  • 14,153
  • 18
  • 94
  • 227