Questions tagged [abstraction]

Abstraction is a computer science concept in which an implementation is separated from its interface.

Abstraction is a computer science concept in which an implementation is separated from its interface. Abstraction allows an implementation to be modified without changing the interface, so that other code which relies on this interface does not have to be modified.

For instance, a function prototype in C would be considered the function's interface, and its definition is considered the implementation. The function definition can change (for instance, to improve performance or fix a bug), but as long as the function signature (as specified by the prototype) is the same, any code calling the function can remain the same.

1121 questions
0
votes
1 answer

using an abstraction

If the predicate bit? returns #t if the items is 1 or 0 (define bit? (lambda (item) (if (equal? item 0) #t (if (equal? item 1) #t #f)))) how can i use bit? in a new procedure, all-bits? that returns #t if all items…
Frankie V.
  • 23
  • 3
0
votes
2 answers

how to organise my abstraction?

I have a set of functions that I have in a class. These function are a set of lowest commonality. To be able to run this I need to generate certain info, but this info can arrive with my class from one of two routes. I'll try to summarize my…
DaveM
  • 734
  • 4
  • 11
  • 35
0
votes
4 answers

Java extension/abstraction/implementation question

I have three classes (class A, class B, and class C). Class A calls an instance of B and runs start(). Class B extends Thread, so when start() is called, anything in the run() method is executed. In the run() thread, there is an instance of class…
Monster
  • 1,573
  • 6
  • 23
  • 35
0
votes
3 answers

access inner attributes of builtins

I have a simple question. As everything is an object in python, can I access the inner attributes of a builtin object. e.g. a='some String' I want to access in the inner attributes of the string object a. Here is what I'have tried:- for x in…
GodMan
  • 2,561
  • 2
  • 24
  • 40
0
votes
4 answers

How does Action work?

I'm trying to figure out how to properly use an Action delegate that takes more than one (through ten) type arguments like so: Action for example. Let's say I'm using the following function prototype: public void SomeFunc(Action
aevitas
  • 3,753
  • 2
  • 28
  • 39
0
votes
0 answers

Single Method to create Sorted List where T : Base Class

I have an interface for items which are Votable: (Like StackExchange, Reddit, etc...) // Irrelevant properties left out (Creator, Upvotes, Downvotes, etc) internal interface IVotable { double HotScore { get; set; } double VoteTotal { get;…
Wesley
  • 5,381
  • 9
  • 42
  • 65
0
votes
1 answer

Boolean Abstraction C Program

I'm trying to compute the abstraction of the following C code fragment, with the predicate: b: { x >= 0 } 1. if( x > 5 ) 2. x = x - 2; 3. else 4. x = abs( x ) + 6; 5. assert( x >= 0 ); so far I abstracted: 1. if( * ) // not sure if I should put…
Maputo
  • 963
  • 1
  • 10
  • 22
0
votes
1 answer

Linqs is ".Distinct()"ly Indistinct

using System.Linq; var a = new byte?[][,]{ new byte?[,]{{1}}, new byte?[,]{{1}}, new byte?[,]{{2}}, new byte?[,]{{1, 2, 3}, {4, 5, 6}}}; a = a.Distinct().ToArray(); However 'a' still contains a duplicate. Am I doing this…
alan2here
  • 3,223
  • 6
  • 37
  • 62
0
votes
2 answers

How to push elements into a stack using an array of void* as data structure?

Lately I've been writing code in C for a generic stack using an array of void pointers. After doing some tests everything seemed to be fine, until this last test: while(i < 9) { push_pila(mi_pila,(int*)&i); i++; } As you can see I'm passing…
mayhem
  • 39
  • 3
  • 9
0
votes
1 answer

How do I get around not using global variables and passing too many arguments?

A bit of a complex problem to describe here: I would like to have a function AB(), which maps one input to another, through an intermediate value. More specifically, the function is made up of two function, let's call A() and B(), which both return…
zhuyxn
  • 6,671
  • 9
  • 38
  • 44
0
votes
1 answer

How to access base class data from parent class

How can I access function of class B, when I have instantiated class A, Instead of making abstract class? what is the simplest solution to this problem? class A { public $a = 3; public function addup($var) …
Sam
  • 376
  • 3
  • 10
0
votes
1 answer

Get Handler Abstraction

I was reading up on how to clean up post functions and the idea seems very useful. I added onto the idea of an IFormHandler by adding a couple more methods and making the class abstract. public abstract class FormHandler { private readonly…
Stefan Bossbaly
  • 6,682
  • 9
  • 53
  • 82
0
votes
1 answer

Grails domain class id inheritance

I have four domain classes having common properties, transID, createdDate wherein the transID is typed int and mapped as the Primary Key of the table. By rule of abstraction, we seperate the common properties/attributes to an abstract class then let…
David B
  • 3,269
  • 12
  • 48
  • 80
0
votes
1 answer

PHP crud abstraction methods

this is my first question after several years of founding good answers over here. I'm re-coding one of my work trying to use a more deep level of OOP aproach but i don't know if what i'm doing is "correct". What i'm trying to do is a simple product…
gdi
  • 9
  • 2
0
votes
2 answers

How to perform an action programmatic like action performed of JButton?

I have a actionSave class which extends AbstractAction.I use it for save button. somewhere else i want to run the same instant of it which was used for the button. I came to conclusion to use it as below but i do not know what to pass as…
itro
  • 7,006
  • 27
  • 78
  • 121