Questions tagged [abstract]

abstract is a keyword shared by a multitude of object-oriented programming languages. Methods and classes can be marked abstract to indicate that they do not contain the full implementation of application logic and have to be extended. Abstract classes can not be instantiated and serve the purpose of providing a uniform interface for their subclasses, as well as the implementation of common methods that don't have to be reimplemented for each subclass.

abstract is a keyword shared by a multitude of object-oriented programming languages.

Methods and classes can be marked abstract to indicate that they do not contain the full implementation of application logic. Abstract classes can not be instantiated and serve the purpose of providing a uniform interface for their subclasses, as well as the implementation of common methods that don't have to be reimplemented for each subclass.

The exact meaning of abstract depends on the programming languages in question, some of them being: Java, C#, php, C++, Delphi Pascal. Similar logic can also be implemented using different keywords in other languages ( for example, Oracle PL/SQL allows to create abstract classes and methods by declaring them NOT FINAL)

The power of abstract methods and classes is widely used by design patterns.

2521 questions
0
votes
2 answers

How can I use abstract method with different parameters on classes?

How can I use an abstract method with Overriding on two classes.? But these two classes have the same method but different parameters. Is there any solution or should I make the method not abstract and type for each class differently? public…
0
votes
1 answer

How to add abstract arraylist inside abstract arraylist

So I have this problem. I want to make shopping cart program. I declare 3 classes such as Food, Drinks, and Miscs. Those classes become the kind of items that the customer bought. each of the class contain String Name and int price. then there is a…
0
votes
1 answer

How can I use abstract class properties with metaclasses?

I've created an abstract class property for class Parent using metaclasses: from abc import abstractmethod, ABCMeta class ParentMeta(ABCMeta): @property @abstractmethod def CONSTANT(cls): raise NotImplementedError() class…
vandenheuvel
  • 349
  • 2
  • 13
0
votes
1 answer

Best way to handle overlapping method definitions due to generic inheritance

I've run into an issue in the past where I want two methods in an abstract class that, once implemented, would wind up with the same method definition. Obviously, I can name the methods slightly differently, but this seems inelegant because they…
R Stevens
  • 65
  • 6
0
votes
1 answer

Abstract generic react class missing prop

I have a problem with React abstract generic class. When I declare one , there is missing prop on the child class and probably im doing the generic wrong. Main issue is Type '{ moving: "no"; }' is not assignable to type 'Readonly
mhan
  • 121
  • 1
  • 2
  • 5
0
votes
0 answers

How can I require that a class has fromJson in Dart?

With abstract classes I can require that a class that implements my abstract class has some method. I can type and I can call every Method on objects of type T that I have specified in MyAbstractClass. But how can I make…
EinEsellesEniE
  • 129
  • 1
  • 10
0
votes
1 answer

How to get the class of a static object attribute

I have a parent class Tile and inherited classes Walltile, FloorTile, EntityTile. Each inherited class have BufferedImage attributes that is related with its name. public class WallTile extends Tile { public static BufferedImage WATER_TOP_LEFT =…
0
votes
1 answer

Writing interface for Matrix

I am writing an Interface for Matrix class in C++ So all functions need to be virtual Now in the below code I have defined a virtual function virtual Matrix add(Matrix A, Matrix B) const = 0; The problem I see is the class Matrix is not defined.…
puneeta
  • 5
  • 3
0
votes
0 answers

What Interfaces, abstract classes and classes does i need for my project?

iam new here, my english is not the best, but i hope you understand my question and maybe can help me. I made a little project: Interface: vehicle Abstract Class: vehicleImpl implements vehicle Interface: train extends vehicle Class: trainImpl…
0
votes
0 answers

Can't instantiate abstract class Item with abstract methods getAdminCharge, getFinesPerDay. Unable

from abc import ABC, abstractmethod import datetime from typing import List class Item(ABC): _loanDuration = 14 @classmethod def getLoanDuration(cls): return cls._loanDuration @classmethod def…
md noh
  • 9
0
votes
1 answer

Could you please check my machine integer?

i got a little problem with my integer machine, si it's an abstract integer machine, from the textbook i need to make a RESET and INC (increment) button. The RESET button set the final state with 0, and INC button increment the value of current…
Abyan
  • 1
0
votes
1 answer

How to create the Channel Credentials object in Grpc.Core.Api.dll using LabVIEW .NET constructor Node?

I tried to use the Grpc.Core.Api.dll, build from the C# nu get Package for the Channel Credentials using LabVIEW .NET constructor node but it throws an error telling 'can't create an instance for the abstract class. How to resolve it so that I can…
Unknown
  • 17
  • 6
0
votes
0 answers

Problem with implementing a generic abstract interface, java

Hi I have this code where I'm trying to implement a C-Sharp like(not the best way to put it I know) getter setter functionality in java There was no problem when I defined getters and setters separately however when I started to make an…
hirad davari
  • 103
  • 6
0
votes
0 answers

Strange error in Netbeans when moving class to new folder

I have: abstract class Menu extends JFrame class IncomeMenu extends Menu Everything works perfectly if both classes are in the same folder, but as soon as I move the Menu class to a separate folder (that I created to store all the abstract classes)…
0
votes
1 answer

Dart / Flutter - class doesn't have to implement abstract class's abstract methods?

in Flutter we have class abstract class PreferredSizeWidget implements Widget { Size get preferredSize; } and @immutable abstract class Widget extends DiagnosticableTree { const Widget({ this.key }); final Key? key; @protected @factory …
maxpill
  • 1,211
  • 1
  • 11
  • 18
1 2 3
99
100