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
3
votes
2 answers

Improvement of package-private classes in Java

In my experience, package-private visibility for classes in Java is turning out to be redundant. Package-private visibility seems to be based on the premise that a class which is almost-privately used by another class is likely to be kept in the…
Teddy
  • 4,009
  • 2
  • 33
  • 55
2
votes
1 answer

How to change a type's accessor with Mono.Cecil

Is this possible? I want to make a public class internal. Thanks
Andrew Bullock
  • 36,616
  • 34
  • 155
  • 231
2
votes
2 answers

Parameterize Generic Type with private member

When creating a class with a generic type, it seems to be impossible to use a private class as type parameter, even when the class is an inner class of the generic type. Consider this code: import java.util.Iterator; import test.Test.Type; public…
SilverNak
  • 3,283
  • 4
  • 28
  • 44
2
votes
1 answer

F# internal visibility changes Record constructor behavior

I'm caling an API using Flurl. //# models.fs module models = type Ticker = { Ask :decimal; Bid :decimal; Last: decimal; High :decimal; Timestamp :int; } //# Client.fs namespace MyLibrary // ... some code …
Alex 75
  • 2,798
  • 1
  • 31
  • 48
2
votes
2 answers

Sharing a C++ DLL and H file with customer

A first in my professional life, I must deliver a DLL to a customer that contains our base, generic software and an interface that makes it work the way the customer wants it + allows the customer to feed in inputs and read outputs. Now my big…
Charles
  • 988
  • 1
  • 11
  • 28
2
votes
3 answers

Hiding and changing div elements in Jquery

Hi Guys i kindly need your help,i have two buttons on web page when button1 is clicked an arrow appears underneath it and the button's background color changes,when button2 is clicked same applies it but the arrow underneath button1 disappears and…
Edward Okech
  • 151
  • 3
  • 9
2
votes
3 answers

When to package-private (no explicit modifier) in java?

I have been reading the tutorial Controlling Access to Members of a Class. I am confused what might be good use case for using package-private. Because as I understand, you can always change your package declaration to whatever the package…
codefx
  • 9,872
  • 16
  • 53
  • 81
1
vote
3 answers

Ways to work around the lack of package access specifiers?

I'm new to Java. I've discovered, while trying to structure my code, that Java intimately ties source file organisation (directory structure) to package structure and package structure to external visibility of classes (a class is either visible to…
bacar
  • 9,761
  • 11
  • 55
  • 75
1
vote
2 answers

Why is public inheritance advocated when reducing the publicly visible API seems preferable from a maintainability perspective?

I am using bada and refer to the tutorial here, which begins: class MainForm: public Osp::Ui::Controls::Form, public Osp::Ui::IActionEventListener, public Osp::Ui::ITouchEventListener { I am running code where I…
John
  • 6,433
  • 7
  • 47
  • 82
1
vote
1 answer

Can I customize the HTML, CSS, and JS for UI5 / Fiori?

Is it possible to add CSS classes and add or edit the JavaScript to make things look and feel different without colliding with SAPUI5 support or releases? Regarding micro animations, loading behavior, change of boarders, fonts, and adding an hover…
1
vote
1 answer

Call private or protected method from an include file

myclass.php class myclass { private $name; public function showData(){ include_once "extension.php"; otherFunction($this); } private function display(){ echo "hello world!"; } } extension.php function otherFunction($obj){ …
CMS scripting
  • 669
  • 1
  • 7
  • 13
1
vote
2 answers

Use the using directive on a private nested class

I have been developing a library for a while and now that I think it's ready, I am trying to follow the pimpl principle in order to hide implementation details. // File Class.h class Class { public: Class(); private: class ClassImpl; …
Xatyrian
  • 1,364
  • 8
  • 26
1
vote
3 answers

How to implement Java graph data-structure and class with restricted visibility?

I am currently learning about data structures (eg LinkedList, DoublyLinkedList, ArrayList,...) and I was wondering how to implement a (not directed) graph in Java. I was thinking about two classes: Graph and Node Each node should know to which…
goerlibe
  • 120
  • 1
  • 12
1
vote
0 answers

Why is browser behaviour "unpredictable" for this CSS/HTML toggle-display?

This code, from a Fiddle at http://jsfiddle.net/8gC3D/471/ in an answer at Tooltip with HTML content without JavaScript) should produce an image which, when hovered over, disappears and causes another element to appear elsewhere on the page. But it…
talvi
  • 39
  • 10
1
vote
1 answer

Pattern for class attribute that can only be altered by others

So let's say I have a Door class and a Lock class. Instances of the Door class have a lock property that is an instance of the Lock class. I want the door to "own" it's instance of the Lock but I don't want the door to be able to alter its own lock.…
emersonthis
  • 32,822
  • 59
  • 210
  • 375