Skip to main content

Questions tagged [encapsulation]

Encapsulation is the principle of bundling software elements in a way to hide implementation details and to expose only a known interface.

0 votes
6 answers
302 views

In a certain program I would like to have three objects, say, a, b, and c, with c being a shared private member (sub-object) of a and b. The data between the three objects shall only go this way: a &...
Alexey's user avatar
  • 958
0 votes
3 answers
161 views

A service interface allows a service layer to support backwards compatibility. As long as the different versions of the API are still supported, then changes can be added to the newer versions of the ...
Vaccano's user avatar
  • 4,077
5 votes
1 answer
577 views

Using assimp I've created a function to load 3D models and it does everything I need and I don't plan to use another library or write something custom, however, I am curious how techniques such as ...
Konjointed's user avatar
0 votes
2 answers
209 views

I have a project where there is a primary, high-level, opaque struct with many functions that operate on it. Maybe I am simulating a CPU. How might the corresponding source code be organized? One way ...
Ana Nimbus's user avatar
2 votes
2 answers
379 views

This question is language/framework agnostic. EDIT: The comments and answers have highlighted how different languages approach events differently, which made me realize this question isn't really ...
Michael Haddad's user avatar
1 vote
6 answers
553 views

I have a question about encapsulation and I read these two topic (this & this) but I got more confused. I've been reading Head First Object-Oriented Analysis and Design book and I'm trying to ...
Mehdi's user avatar
  • 29
2 votes
2 answers
2k views

Many times while writing MVVM apps in C# I've come across this sort of problem where I need to expose the model in a view model so that I can get it in another view model and do something with it. ...
aelsi2's user avatar
  • 31
9 votes
4 answers
3k views

I'm writing this library in which the user can provide custom code defining the algorithm used for finding an optimal solution. In the papers that I have read, the targeted user thinks in terms of ...
Mehdi Charife's user avatar
1 vote
2 answers
255 views

Let's say that I have a Parent class and a Child class, Parent relies on Child to perform, say, some network request: class Parent { ... public init(){ const child = new Child(); const ...
Tizio Fittizio's user avatar
0 votes
2 answers
383 views

I was submitting this code in Java to an AI tool that checks for OOPS modeling and it says that this class is breaking encapsulation, although it did not gave any reason why. The objective is to store ...
Ayush Kumar's user avatar
0 votes
0 answers
91 views

When working with functions that run a few short "procedures" in sequence that are not used anywhere else and it makes sense to keep it all inline, in a single function, a large part of the ...
Jake1234's user avatar
  • 129
4 votes
4 answers
841 views

As I am learning OOP principles, I know that it is always good practice to hide the inner workings of classes so that the end user can't access or break them. I understand why this is important. The ...
Caleb Shank's user avatar
1 vote
2 answers
5k views

I have a single *.h file. This file contains a single (more to come) function declaration. Now the implementation of that file is very complex. the corresponding *.cpp contains several function ...
user avatar
3 votes
5 answers
393 views

I'm learning to make games with OOP and there's something I don't understand. What I can see is that the more I add methods to a class, the less it becomes reusable and flexible. For example, if we ...
Voko's user avatar
  • 233
0 votes
1 answer
218 views

Assume a low-level API is provided without source code (e.g. DirectX). The API provides a virtualization of hardware resources (GPU, CPU, audio card, etc.), which enables the user to call hardware-...
chckx592's user avatar

15 30 50 per page
1
2 3 4 5
15