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...
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...
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:
...
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...
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 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...
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:...
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?
...
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...
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...
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...
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...
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...
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...
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...
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...
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...
#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...
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;
...
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...