answersLogoWhite

0

It depends on the language. Java provides the Objectsuperclass (defined in java.lang) from which all other classes must be derived. This allows us to treat any Java object as being "of the same type". This is not necessarily a good thing -- separate types should be kept separate -- however garbage collection would be difficult to implement without a common base class to refer to every type of object.

C++, on the other hand, is not a "pure" object-oriented language; it is a multi-paradigm (procedural, object-oriented and generic). Programmers are free to decide for themselves how to classify user-defined objects, but the built-in types (such as int and double) are not derived from classes, so there can be no superclass. If there were, it would not be possible to write (let alone support) low-level C-style code where there can be no classes of any type. In addition, the standard library types (such as vector and string) have no superclass. In particular, a vector and a vector cannot be regarded as being "of the same type" even if U derives from T. If we really require this functionality, we can easily cater for it in code, but it isn't provided by default (via a superclass) because the language itself does not require it.

User Avatar

Wiki User

7y ago

What else can I help you with?

Related Questions

Which class includes all the others?

Super class in object oriented programming


What is the super clas of class?

All Java classes with no defined superclass, extend from java.lang.Object.


What is C-Sharp equivalent for Java's Object main superclass?

System.object is the base class of all other classes in the .NET framework.


Why do you use superclass init method inside your init method in a servlet?

Because, that is how all Java classes work. When a class is initialized/created all the classes it extends from (its super classes) need to be initialized as well.


What is sub class in Java?

A sub class is paired up with its super class. These can also be called a child and parent class.The subclass will inherit all of the variables and methods from its superclass. And one superclass can have multiple subclasses, but a subclass can only have one superclass.Here's an example:public class childName extends parentName {...}This means that childName will inherit everything from its superclass, which is parentName.The advantage of this inheritance is that you do not need to copy/paste lots of code for many similar subclasses, and if you want to change something you only need to make one change in the superclass.


What happens if an abstract modifier is applied to class. Explain?

The classes which have one or more abstract methods are abstract. To declare a class as abstract, use the abstract keyword in front of the class keyword, before the class declaration. Abstract classes cannot be instantiated. Similarly the new keyword cannot be used to create an object of the abstract class. Remember that the constructors and static variables cannot be declared as abstract. Any subclass of an abstract class must either implement all of the abstract methods in the superclass or be itself declared abstract.


What portions of a super class can be used by subclass?

Any members of a superclass which are declared as public or protected can be used by all subclasses.


Which is the topmost class in java?

The "Object" class is the topmost class in the class hierarchy. Classes inherit directly from this class by default; all classes inherit from Object directly or indirectly.


What is the Christianity social class?

Within Christianity all people are just considered children of God, thus there are no "social classes" within Christianity.


Are amphibians and reptiles and birds and mammals all in the same class?

No, not in a straight forward traditional classification sense... Amphibians = class Amphibia Reptiles = class Reptilia Bird = class Aves Mammals = class Mammalia They can be categorized all together in the "superclass" Tetrapoda.


Which abstract class is the super class of all classes used for writing characters?

java.io.Writer


Is class's is singular or plural?

The noun class's is the possessive form of the singular noun class.Adding the apostrophe s ('s) to the end of the noun indicates that something belongs to a class.Example: Our class's trip is tomorrow.The plural noun is classes.Example: I have four classes tomorrow.The plural possessive form is classes'.Example: All of my classes' grades have improved. (the grades for all of my classes)