Top Answer
User Avatar
Wiki User
Answered 2011-05-27 23:32:49

An abstract class is a class that has a pure virtual function.

A pure virtual function can be used in a base class if the function that is virtualised contains parameters that can and should be interchangeable, but the function should remain intact.

For example, there is a base class Object in a game that will contain movement for simple objects, but the movement function may need to use different parameters per object.

User Avatar

Your Answer

Still Have Questions?

Related Questions

Can an abstract class inherit from another abstract class in c plus plus?

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

Abstract class in c plus plus?

Any class that has one or more pure-virtual functions is an abstract class.

What is the use of the abstract class in c plus plus language?

To provide a generic interface for two or more concrete classes.

What is the difference between Virtual Base Class and Abstract Class in c plus plus?

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

What is abstract data type for C Plus Plus?

In C++, an abstract data type is a class that must be derived into a child class. It is not possible to instantiate an abstract class. Another way to define this is to say that an abstract class contains pure virtual functions or that it inherits from a class with pure virtual functions but does not provide an implementation for them.

Write abstract class in c plus plus?

An abstract class is any class definition that contains at least one pure-virtual function. class AbstractClass { public: virtual void DoSomething()=0; // Pure-virtual. };

Is an abstract class virtual by default?

Unlike abstract class in C++, the abstract class in C# does not have any methods defined as virtual by default. The concept of virtual are not the same between C# and C++, either. Any virtual method must be defined explicitly in C#. Related to abstract methods - interestingly, an abstract class in C# does not have to have any abstract methods. However, the reverse, if a class need to have at least one abstract method, that class must be defined as abstract.

Abstract data types in c plus plus?

An abstract data type is any class or struct that contains at least one pure virtual function.

What is the difference between class and object in c plus plus?

There is no difference; to define an object in C++ you use the 'class' definition

When you define a c plus plus class what items are considered part of the interface?

The interface of a C++ class is the public methods and attributes that are exposed by the class. In a pure abstract base class, the interface is enforced by the compiler in each of the derived child classes.

What is an abstract class in c plus plus?

An abstract class is a class which has atleast one pure virtual function.An abstract class does not have any objects.It is used just for sharing it's members to some other classes.the class that shares the members of base class should define the pure virtual function if not object is not been created for example: class classname { protected: virtual datatype fname(parameters)=0; };

What is generic classes in c plus plus?

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.

What is an abstract base class in C plus plus?

An abstract class is a class that contains at least one pure virtual function. A definition is not needed for pure virtual functions, as derived classes must override them. virtual void foo() = 0; Abstract classes cannot be instantiated. They provide a template for derived classes, and you can also point to them with pointers to utilize polymorphism. Additionally, a class derived from an abstract class must override ALL of the pure virtual functions, in order to make the class concrete. Implementing fewer than all of them will automatically make the derived class abstract, and instantiation of the derived class will not be possible.

What is the use of structure in c plus plus?

You use a structure just as you would use a class in C++. The only real difference between the two is that a structure's members are public by default, while class members are private by default.

What is inheritence and its use in c plus plus?

Inheritance is the process by which the properties of base class is derived by derived class or it's sub classes.

What is an object in C plus plus?

In c++ object is an instance of a class.class is an abstract data type.abstract data type means humen defined data type which is created in order to full fill the requirements of the problem.once we create a class ,we can have as many objects (of that class )as we want.

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.

What is abrstac class and virctul function in c?

I have to assume the question is for C#, not C, because C does not provide abstract class concept.public abstract class A1 { public virtual void SayHi() { Console.WriteLine("Hello World"); }public abstract void DoSomething();}The above abstract class A1 contains 1 virtual method and 1 abstract method. [Note that because of the abstract keyword for Dosomething(), A1 must be declared as abstract. An abstract class DOES NOT have to have any abstract methods!!)The virtual function SayHi() provides a implementation, while the abstract function provides nothing but only the method signature( the name of the method, the return type, and method parameters and their data types). The derived class of A1 has the option to override SayHi() and must implement (or defer to subclasses of this derived class) the method DoSomething()

What are the differences between C plus plus and C sharp?

C# is Microsoft's programming language for the common language infrastructure, primarily for use in its .NET initiative. It is based on C++ principals, but is not cross-platform and is highly abstract.

What is an instance of a class in c plus plus?

You have a class(i.g. MyClass): class MyClass{ public: int MyData; }; And then you use the class like this: int main(){ MyClass MyObject; MyObject.MyData=7; }

What is the role of object in c plus plus?

An object in C++ is an instance of a C++ class.

Why you are using class in c plus plus?

since c++ is an object oriented programming language we use object to access each data member & member functions.so that class concept is come on

Still have questions?

Trending Questions
Best foods for weight loss? Asked By Wiki User
Previously Viewed
Unanswered Questions
Where is 5.9055118 on a ruler? Asked By Wiki User