answersLogoWhite
Computer Programming
Java Programming
C++ Programming
The Difference Between

What is abstract base class?

171819

Top Answer
User Avatar
Wiki User
Answered
2006-07-31 04:23:08
2006-07-31 04:23:08

A class that does not include an implementation and therefore cannot be directly used. It is used to derive other classes; the derived classes implement the methods.

001
๐Ÿฆƒ
0
๐Ÿคจ
0
๐Ÿ˜ฎ
0
๐Ÿ˜‚
0

Related Questions


Yes an abstract class can inherit from another abstract class but all the methods of the base abstract class must be abstract.


abstract class no defination used by derieved class where virtual base class is defination that can be overriden later on


An abstract class cannot have a constructor and hence you cannot invoke the constructor of the class - i.e., you can instantiate an abstract class and hence you cannot call the constructor of an abstract class.


An abstract class(or classes) can't have a constructor and hence you cannot invoke the constructor of the class (for example, you can instantiate an abstract class and hence you cannot call the constructor of an abstract class).


An abstract class is a class that cannot be directly instantiated. The purpose of such a class is to put some logic in a base class and force derived classes to implement the remaining functionality. Since the full functionality is only available in the derived class, the base class is declared as abstract so that it cannot be instantiated directly.


A logical abstract base class for a class called CricketPlayer could be Batsman class or Bowlerclass.



Abstract classes are to be extended until to a concrete class.Can have both abstract & non abstract methods.An Abstract class can not be instantiated.A non abstract class can be extended to an abstract class.If At least one abstract method present in a class then that class must be abstract.abstract & final modifiers can never be together.abstract classes can have both abstract methods & non abstract methods.


That would depend on what type of game you are developing. Unlike a concrete class which can be instantiated in its own right, an abstract class can only be instantiated through derivation. In other words, an abstract class can only be used as a base class, and is known as an abstract base class for that reason. We can also refer to them as abstract data type, given a class is also a type.We typically use an abstract base class to define a common interface for all its derivatives. If we need to divide the interface to cater for specialisations, we can derive intermediate base classes from the abstract base class. In this way we do not pollute the common base class with uncommon virtual methods.Abstract base classes typically have no data members and thus incur no memory overhead. However, if data members are required, they should be kept to a minimum and should only be declared if essential to the derivatives. Data members that are essential to some but not all derivatives should be placed in the appropriate intermediate class instead.In a game (or indeed any program) we might have many objects of many different types. However, objects that have a common public base class (including abstract base classes) can be treated as being "of the same type" (the common base). For instance, we might define an abstract Object base class such that all classes that publicly derive from the Object class can be treated as being of the same type (an Object).In a game we typically have objects that cannot be moved (static objects) and objects that can be moved (non-static). We can separate the two types of object by deriving Static and Nonstatic abstract base classes from our common Object class. We can then derive further intermediate classes from these two classes to cater for all the different types of object in our game. For instance, an armoury usually provides a choice of weapon and allows the user to select a primary and secondary weapon, thus we can derive a common Weaponabstract base class from our Nonstatic abstract base class, and then derive concrete (specific) weapons from the Weaponclass.


//We Declare an abstract class as-abstract class Car{}//Example of an abstract methodabstract void hondaCity(); //no method body and abstract//Example of Abstract class that has an abstract methodabstract class Car{abstract void run();}class HondaCity extends Car{void run(){System.out.println("runs smartly");}public static void main(String args[]){Car obj = new HondaCity();obj.run();}}//OUTPUT will be-runs smartly


An abstract base class may have member variables. Whether or not it actually needs member variables depends on the nature of the base class itself. If the variable is common to all derived classes, then it makes sense to place the variable in the base class. If some derived classes have no need of the variable, then it is better to derive an intermediate class with the variable, and to derive those classes that require that variable from the intermediate class, rather than directly from the abstract class.


An abstract factory class is a class which has an abstract method to create an object.


an abstract class is nothing but class which contains both abstract and concrete methods for abstract class we r nt create object Syntax for pure abstract class is abstract class x { public void abstract y(); public void abstract z(); public void abc() { }


Any class which has one or more abstract methods is called an abstract class. But in the normal class we can't have any abstract methods. We cannot create an object for the abstract classes. When we inherit the abstract class we should implement the abstract method which we inherit.


a abstract class is class which has a abstract method which means a method does not its own body.


You can't put an abstract method (pure-virtual method) in a normal class because the normal class would become abstract itself. Only non-abstract classes can be physically instantiated as objects, and only if they fully implement all the abstract methods inherited from their base classes.


If a class has one abstract method ,the class has to be an abstract class.Methods can be implemented in abstract class.Whereas a interface is like a abstract class...the only difference being that the methods are never implemented in Interface.


An Abstract method is one that has only a method declaration and no method definition. Similarly an abstract class is one that has one or more abstract methods. You can declare an abstract class or methods by using the keyword abstract in the class definition. Ex: public abstract class TestAbsClass { abstract void method1(); } Any class that extends this abstract class must provide implementation to the method "method1" or else it would have to be abstract as well.


An abstract class is an abstract data type (ADT). An ADT has one or more pure-virtual functions that must be implemented in derived classes or they, too, become abstract. ADTs cannot be instantiated, even if they provide implementations for their pure-virtual functions. They are intended to be derived -- they merely provide the definition of an interface for those derivatives. A virtual class is used when a derived class uses multiple inheritance, where two or more of the base classes inherit from a common base class. Since the derived class would inherit two or more versions of the common base class, an ambiguity exists as to which common base class would be used via implicit calls in the derived class. One way around this is to use explicit calls from the derived class. But by declaring all but one of the base classes to be virtual, only one copy of the common base class will be visible to the derived class.


A generic class is a class that contains one or more virtual methods and is intended to act as a base class for more specific, specialised classes, known as derivatives or derived classes. A generic class that has one or more pure virtual methods is also known as an abstract base class or abstract data type.


A constructor of a class in invoked when a object of that class is created. As an abstract class can't have an object, so we can't create a constructor of the abstract class. But we can create a constructor of a concrete subclass of that abstract class and we have to pass the object of that concrete subclass to the abstract class.


An abstract class is one that has one or more abstract methods. i.e., methods that have only a declaration and no implementation. A fully abstract class is one that has only abstract methods and does not provide implementation to even one method in the class. A fully abstract class is equal to an interface.


abstract is keyword this is used for define abstract methods and abstract classes.abstract method means if you want define a method with out any body at that time you should define a method with abstract keyword. EX:public abstract int add() { } if you want define a class with abstract method must and should you define a class will be abstract class. Abstract EX:abstract class abc { abstract methods ------------ non abstract methods ---------------- } you can define abstract as well as non abstract methods in abstract class. in normal class you can define only normal methods only. you can't acess the methods which are in the abstract class from the same clss.by child class only you can acess the methods which are in abstract class. if you want to inherit abstract class must and should you have to define abstract methods which are in abstract class. Interface ----------:- interface is also like a clss.in interface you have to define only abstract methods only.you can't define normal methods in interface. EX: interface abc { abstract methods } by inharitance only you can acess the methods what are in the interface through the class.


No. The whole point of an abstract class is that it can not be instantiated.


Assume a "simple" class be a class without the keyword "abstract".You cannot create an instance of an abstract class. An abstract class is intended to be inherited from (to be extended or derived from).A "simple" class is a class that an instance can be created from (via new operator)



Copyright ยฉ 2020 Multiply Media, LLC. All Rights Reserved. The material on this site can not be reproduced, distributed, transmitted, cached or otherwise used, except with prior written permission of Multiply.