virtual

Is there a way to automaticly call all versions of an inherited method?

I'm writing a plug-in for a 3D modeling program. I have a custom class that wraps instances of elements in the 3D model, and in turn derives it's properties from the element it wraps. When the element in the model changes I want my class(es) to update their properties based on the new geometry. In the simplified example below. I have c...

When overriding a virtual member function, why does the overriding function always become virtual?

Hi! When I write like this: class A { public: virtual void foo() = 0; } class B { public: void foo() {} } ...B::foo() becomes virtual as well. What is the rationale behind this? I would expect it to behave like the final keyword in Java. Add: I know that works like this and how a vtable works :) The question is, why C++ st...

C++ Destructor Behavior

I had a question about C++ destructor behavior, more out of curiosity than anything else. I have the following classes: Base.h class BaseB; class BaseA { public: virtual int MethodA(BaseB *param1) = 0; }; class BaseB { }; Imp.h #include "Base.h" #include <string> class BImp; class AImp : public BaseA { public: ...

Apache 2 Sites-Available Configuration

Hello, I am trying to write about 5 websites all on one Apache server which is all on one IP address. For example: /var/www/site1 /var/www/site2 /var/www/site3 /var/www/site4 /var/www/site5 However, if I create a link on site 2 just using, for example. /index.php, you would expect it to look in /var/www/site2/index.php... but it a...

Need Help: Failed to configure Virtual Server on Webmin (mixing * ports and non-* ports with a NameVirtualHost address is not supported)

Hello, I have finish configure the Virtual Server to use domain name. Then I try to restart the httpd, but it give me an error message like below: Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using xxx.xxx.xxx.xxx for ServerName [Thu Dec 24 20:20:26 2009] [error] VirtualHost xxx.xxx.xxx....

Windows 7 Virtual WiFi using C#?

Windows 7 introduced Virtual WiFi which allows you to create hotspots. However I can't find any tutorials on doing it in C#. I found Virtual Router (It is open source and is written in C#) but I can't seem to figure out how it works because it has a lot of unrelated code since it is implemented as a service. Can anyone explain how can I...

Pure virtual method called

I understand why calling a virtual function from a constructor is bad, but I'm not sure why defining a destructor would result in a "pure virtual method called" exception. The code uses const values to reduce the use of dynamic allocation - possibly also the culprit. #include <iostream> using namespace std; class ActionBase { public:...

Button to show virtual keyboard?

I have a ListView and it is possible to use the hardware keyboard to filter out items. However what should I do for phones that don't have a hardware keyboard and only a virtual one? Is there a way to add a button that when pressed, the virtual keyboard shows up? ...

C++ multiple inheritance off identically named operator

hello Is it possible to inherit identically named operator which only differ in return type, from two different abstract classes. If so, them: what is the syntax for implementing operators what is the syntax for using/resolving operators what is the overhead in general case, same as for any other virtual function? if you can provide...

how to hide the virtual keyboard

I don't want to show the virtual keyboard. I tried the below method but it doesn't make any difference. InputMethodManager imm = InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(enter_count.getWindowToken(), 0); enter_count is my edit text I have tried reading up on the InputMethod Ma...

constructor with virtual fuction call in c++

Possible Duplicate: Calling virtual functions inside constructors first of all below code is not working visual c++ , but workin with bloodshed output is 0 , but acc. to me it shud be 1 ; can anyone explain this #include<iostream> using namespace std; class shape { public: virtual void print() const =0; virtual double...

Problem in calling a virtual function across Symbian DLLs.

My IM application setup is like below: User Interface module (exe) Plugin module ( A polymorphic DLL that provides an abstract interface for different protocols to the UI module ) Several Protocol DLLs ( Shared library DLLs that implement the respective protocols, like Jabber, ICQ etc ) Now, I was asked to implement contact list cach...

C++ virtual function execution efficiency

hello I am trying to get a better idea of performance of virtual functions here is an example code: struct Foo { virtual void function1(); virtual void function2() { function1(); } }; struct Bar : Foo { virtual void function1(); } Bar b; Foo b.function2(); b.function1(); f.function2(); for each of three calls in the...

Confusion about virtual/new/override

I am a bit confused about the virtual/new/override thing, here's some example: class A { public virtual void mVVirtual() { Console.WriteLine("A::mVVirtual"); } } class B : A { public virtual void mVVirtual() { Console.WriteLine("B::mVVirtual"); } } class C : B { public override void mVVirtual() { Console.WriteLine("C::mVVi...

Virtual destructor

Do we need a virtual destructor if my classes do not allocate any memory dynamically ? e.g. class A { private: int a; int b; public: A(); ~A(); }; class B: public A { private: int c; int d; public: B(); ~B(); }; In this case do we need to mark A's destru...

Calling a subclassed virtual method from a base class method

class A { public: virtual void doSomething(void) {} void doStuff(void) { doSomething(); } }; class B : public A { public: void doSomething(void) { // do some stuff here } }; B * b = new B; b->doStuff(); It gives me Segmentation fault. What am I doing wrong? It s...

More about Virtual / new...plus interfaces!

Hello again Yesterday I posted a question about the new/virtual/override keywords, and i learned a lot from your answers. But still i remain with some doubts. In between all the "boxes", i lost touch with what's really happening to the type's method tables. For instance: interface I1 { void Draw(); } interface I2 { void Draw(); } cla...

virtual function question...

#include "stdafx.h" #include <iostream> #include <vector> #include <string> class Helper { public: Helper() { init(); } virtual void print() { int nSize = m_vItems.size(); std::cout << "Size : " << nSize << std::endl; std::cout << "Items: " << std::endl; for(int i=0; i<nSize; i++) { s...

Virtual tables on anonymous classes

I have something similar to this in my code: #include <iostream> #include <cstdlib> struct Base { virtual int Virtual() = 0; }; struct Child { struct : public Base { virtual int Virtual() { return 1; } } First; struct : public Base { virtual int Virtual() { return 2; } } Second; }; int main() { Child child; ...

C++ Inherited Virtual Method Still Uses Base Class Implementation

I have a base class called Packet: // Header File class Packet { public: virtual bool isAwesome() const { return false; } } and an inherited class called AwesomePacket: // Header File class AwesomePacket : public Packet { public: virtual bool isAwesome() const { return true; } } However, when I insta...