Skip to content
Advertisement

Does a class without methods have a special name?

What is a class without methods called? I’m trying to understand and learn about classes, so i have the following class “Variables” that doesn’t have methods, only fields, like the field “Server” in a folder called “utilities”:

JavaScript

then this class is called from a method in another class located in another folder or package this way:

JavaScript

is this (the without methods) a particular type of class or is a common class despite not having any method?

Advertisement

Answer

Raman is right in that all objects inherit the methods of the Object class, so you technically can’t have a class without any methods at all.

But if you’re talking about a class that doesn’t override any of those methods, don’t have methods of its own, and most/all fields are public, then people typically call those POD types, or short for Plain Old Data type.

Something like:

JavaScript

would be considered a POD type

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement