answersLogoWhite

0


Best Answer

True - an instance of an abstract class cannot be created.

False - derive (subclass) from a class, not the object (the instance).

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is true about true about abstract data type Object of an abstract class type cant be created. We can derive classes from these abstract classes Object of an abstract class t?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What kinds of game-related classes would be best implemented as abstract?

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.


What is meant by inheritance?

In computer programming, inheritance means to derive a new object from an existing object, such that the new object inherits all the properties of the existing object. In object oriented programming, derived classes inherit the public and protected members of their base classes. This allows new classes to be created from existing classes, without the need to duplicate large chunks of code in the existing class. The new class can augment the inherited code to provide more specific behaviour.


Is an abstract class cannot have any member variable in C plus plus?

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.


Abstract method with example in java?

An abstract in java is used to specify that the class/function is not yet complete. When a class in declared as abstract it means that it is not meant to be instantiated (you can't create variables of that type). This is because they are meant to be more of a guideline for other classes. When a class extends an abstract class it must either define all of the abstract methods from the abstract class or it must also be declared as an abstract class itself.


What is the abstract feature in c plus plus?

Abstraction generally refers to abstract classes. An abstract class is one that cannot itself be instantiated, but can be derived from. Abstract classes are conceptual classes rather than concrete classes, and are intended to provide a common interface to the concrete classes derived from them. A class becomes abstract when it contains one or more pure-virtual methods, which must be implemented in the derived classes otherwise they become abstract classes themselves. A concrete class is one that provides a complete implementation for is abstract base classes, or inherits implementations from base classes other than those that originally declared the function to be pure-virtual. An example of an abstract class is Shape. All shapes can be drawn, therefore Shape will have a Draw() method. However, it cannot implement this method unless it knows what type of shape it actually is. Therefore the Draw() method should be declared pure-virtual, thus rendering the Shape class to be abstract. You can then derive concrete shapes from the Shape class, such as Circle and Square classes, which will each provide the actual implementation for the Draw() method. Since Square and Circle are types of Shape, you can create collections of Shape objects and call their Draw() methods without regard to their actual type. If the object is really a Square, then calling Shape.Draw() will actually invoke Square.Draw(). There is no need to determine the actual type of the shape because every shape has a common interface. This is really no different to overriding virtual methods in non-abstract classes. The main difference is that one would not be expected to instantiate a Shape (because it is abstract), other than through derivation, and the pure-virtual methods MUST be implemented by the derived classes, whereas normal virtual methods are simply expected to be overridden but it is not a requirement to do so unless you require an enhancement to the base class method. Abstract classes typically have few if any member variables and little or no implementation. Ultimately, the class exists purely to provide a common interface to all its derivatives, and only functionality and member variables that are common to all its derivatives should be placed within it. Even if the abstract class provides a complete implementation for all its pure-virtual methods, you cannot instantiate an abstract class -- it must be derived from -- and all pure-virtual methods must still be implemented in the derivatives, even if only to call the base class methods explicitly.

Related questions

What kinds of game-related classes would be best implemented as abstract?

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.


What is meant by inheritance?

In computer programming, inheritance means to derive a new object from an existing object, such that the new object inherits all the properties of the existing object. In object oriented programming, derived classes inherit the public and protected members of their base classes. This allows new classes to be created from existing classes, without the need to duplicate large chunks of code in the existing class. The new class can augment the inherited code to provide more specific behaviour.


Is an abstract class cannot have any member variable in C plus plus?

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.


When we use abstract noun of verb?

An abstract noun is a word for something that can't be experienced by any of the five physical senses; something that can't be seen, heard, smelled, tasted, or touched. An abstract noun is a word for something that is known, learned, thought, understood, or felt emotionally.Examples of abstract nouns derived from verbs are:verb to believe, abstract noun = beliefverb to enjoy, abstract noun = enjoymentverb to promise, abstract noun = promiseverb to think, abstract noun = thinkingA noun functions as the subject of a sentence or a clause, and as the object of a verb or a preposition. Examples:His belief will be the basis of his research. (subject of the sentence)We derive enjoyment from travel and discovering new places. (direct object of the verb 'derive')The courage that his promise gave them helped them through their ordeal. (subject of the relative clause)I can figure this out. All I need is a quiet place for thinking. (object of the preposition 'for')


The first classes of animals to derive a backbone were the?

Jawless fish.


First classes of animal to derive a backbone were the?

D) Fishes


Abstract method with example in java?

An abstract in java is used to specify that the class/function is not yet complete. When a class in declared as abstract it means that it is not meant to be instantiated (you can't create variables of that type). This is because they are meant to be more of a guideline for other classes. When a class extends an abstract class it must either define all of the abstract methods from the abstract class or it must also be declared as an abstract class itself.


Does structure support polymorphism?

Yes. The only difference between a struct and a class is that a struct's members and inheritance is public by default, while a class' members and inheritance are private by default. Structs can derive from classes and classes can derive from structs. As such, they are polymorphic.


What is the abstract feature in c plus plus?

Abstraction generally refers to abstract classes. An abstract class is one that cannot itself be instantiated, but can be derived from. Abstract classes are conceptual classes rather than concrete classes, and are intended to provide a common interface to the concrete classes derived from them. A class becomes abstract when it contains one or more pure-virtual methods, which must be implemented in the derived classes otherwise they become abstract classes themselves. A concrete class is one that provides a complete implementation for is abstract base classes, or inherits implementations from base classes other than those that originally declared the function to be pure-virtual. An example of an abstract class is Shape. All shapes can be drawn, therefore Shape will have a Draw() method. However, it cannot implement this method unless it knows what type of shape it actually is. Therefore the Draw() method should be declared pure-virtual, thus rendering the Shape class to be abstract. You can then derive concrete shapes from the Shape class, such as Circle and Square classes, which will each provide the actual implementation for the Draw() method. Since Square and Circle are types of Shape, you can create collections of Shape objects and call their Draw() methods without regard to their actual type. If the object is really a Square, then calling Shape.Draw() will actually invoke Square.Draw(). There is no need to determine the actual type of the shape because every shape has a common interface. This is really no different to overriding virtual methods in non-abstract classes. The main difference is that one would not be expected to instantiate a Shape (because it is abstract), other than through derivation, and the pure-virtual methods MUST be implemented by the derived classes, whereas normal virtual methods are simply expected to be overridden but it is not a requirement to do so unless you require an enhancement to the base class method. Abstract classes typically have few if any member variables and little or no implementation. Ultimately, the class exists purely to provide a common interface to all its derivatives, and only functionality and member variables that are common to all its derivatives should be placed within it. Even if the abstract class provides a complete implementation for all its pure-virtual methods, you cannot instantiate an abstract class -- it must be derived from -- and all pure-virtual methods must still be implemented in the derivatives, even if only to call the base class methods explicitly.


What are the assumptions of the concepts of class?

A class is the basic unit within any OO language. Any OO program must have at least 1 class. And any class must have at least 1 non-private method (in C#, Properties may be considered methods, like the mutators, getters and setters, in Java). Non-private means public, protected, internal, or internal protected. A class must derive from another class, except the class Object. Any class without explicitly extends another class is derived from or extending Object. If a class defines at least one abstract method, itself must be marked as an abstract class. An Abstract class cannot have an instance, but still need to provide a constructor (at least be protected) for derived classes to be invoked during the instantiation process. An instance of any class when created will occupy some memory.


What primary tissue classes derive from each embryonic germ layer?

I ddon'ttt dknow(with an Indian accent)


What is abstract base 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.