Quantcast
answersLogoWhite
notificationBell

Top Answer
User Avatar
Wiki User
Answered 2012-06-07 10:31:47

It has various meanings depending on the context.

A virtual method in a base class implies the method may be overridden by a derived class, in which case calling that method on the base class calls the method in the most-derived class that implements that method. This is achieved via the virtual table (v-table), so there is no need to determine the actual type of the derived class at runtime.

A pure-virtual method in a base class implies the class is abstract and must be derived from, and that a derivative must implement the method (or it becomes abstract itself). You cannot instantiate abstract classes. They are intended purely to provide a common interface to their derivatives.

A virtual base class is a class that is common to two or more derived classes that may be combined in a multiple-inheritance class. If the derived classes declare the base class virtual, the derived classes will share the same instance of the base class, and the multiple-inheritance class will inherit just one instance of the base class from those derived classes. If the derived classes do not declare the base class virtual, the derived classes have separate instances of the base class, which inevitably leads to an ambiguity in the multiple-inheritance class.

001
๐Ÿ™
0
๐Ÿคจ
0
๐Ÿ˜ฎ
0
๐Ÿ˜‚
0
User Avatar

Your Answer

Still Have Questions?

Related Questions

What is a virtual function in C plus plus?

A virtual function is a member function of a class, whose functionality can be over-ridden in its derived classes. It is one that is declared as virtual in the base class using the virtual keyword. The virtual nature is inherited in the subsequent derived classes and the virtual keyword need not be re-stated there. The whole function body can be replaced with a new set of implementation in the derived class


What is meant by println in c plus plus?

println is not a C++ keyword.




Is it possible to declare a keyword as an identifier in c plus plus?

No. Keywords are reserved and cannot be used as identifiers. However, C/C++ is case-sensitive. So although register is a reserved keyword, Register is not.


What keyword is used in data declarations to indicate a constant in c plus plus?

The const keyword declares any named value to be a constant.


What is the virtual keyword used for in C?

Virtual keyword in C++ is used to make a method virtual.In C++ Virtual method is is used to accomplish run time polymorphism. Virtual methods can be overridden in its derived classes. For example: class A { private: int x; public: virtual void abc() { } }; Class B : public A { private: int y; public: void abc() //abc is virtual here by default and can be overridden { } }; Regards, Rajneesh




What is the use of keyword operator in c plus plus?

To overload an operator. ie to write operator functions


What is the Difference between override and new keyword in C?

An override is the specialisation of a virtual function. The new keyword instantiates an instance of an object in dynamic memory and returns a reference to that object (or null if the object could be instantiated). Both are used in C++, but not C.


What is the use of final keyword in c plus plus?

The final keyword is used to prevent overriding virtual functions. It can be applied to a class as a whole, thus preventing the class from being used as a base class, or it can be applied to a virtual function override, thus preventing that function from being overridden. This can have a significant benefit in terms of performance because we can statically link to final methods rather than dynamically link to them via a virtual table, and thus provide greater opportunities for inline expansion.


What keyword is used to find derivative in C plus plus?

The lazy way is to use a dynamic cast. The correct way is to use virtual functions in the base class. That way you don't ever need to know the derived type -- it simply does what is expected of it.


Instantiation of objects in c plus plus?

Objects are instantiated when statically declared or dynamically created with the new keyword.


How does the use of the 'void' keyword differ in C plus plus vs. C?

It doesn't. Void has the same meaning in both.


Is in is used as a keyword in C language?

Neither "in" nor "is" is a keyword in C.


Why you use zero instead of NULL in c plus plus?

In C++ NULL is defined as 0. It's a design failure, will be fixed with a new 'nullptr' keyword.


What is the Public keyword for in C?

Public isn't a keyword in C. It's a keyword in C++ to state that members of a class are accessible from outside that class.


What is friendly in c plus plus?

The keyword "friend" allows a function or variable to have access to a protected member inside a class.


What is difference between define and typedef in c plus plus?

#define is a preprocessor directive used to declare macros. typedef is a C++ keyword to define a data type.


What does tbuffer mean in c plus plus?

There is no such keyword or data type known as tbuffer in C++. It's most likely an user-defined identifier, possibly a text buffer. But without knowing its actual type or its context it's impossible to say what it means.


What is meaning of keyword in c language?

'Keyword' is a synonym for 'reserved word', it is not specific to C language.


Is main a keyword in C and C plus plus?

No. Main is not a keyword in C or C++. However, your program, when linked, must provide one and only one externally scoped entry point to main(). If you use main in some other context, and you do not provide one and only one entry point main(), then your program will not link nor run.


Is there something that you can do in C and not in C plus plus?

For example: int new; /* 'new' is a keyword in C++ */ char str[3] = "ABC"; /* Won't work in C++ */ void *p; char *s= p; /* requires explicit typecast */


Does the C plus plus programming language use a virtual machine?

No, it does not. But Microsoft Visual Studio 2008 allows you to connect to a virtual machine and run your projects "sandboxed".


Still have questions?

Trending Questions
How old is Danielle cohn? Asked By Wiki User
How many tens make 600? Asked By Wiki User
Previously Viewed
Unanswered Questions
Why we require Microsoft paint? Asked By Wiki User