Greetings all,
I come from Java background and I am having difficulty with multiple inheritance.
I have an interface called IView which has init() method.I want to derive a new class called PlaneViewer implementing above interface and extend another class. (QWidget).
My implementation is as:
IViwer.h (only Header file , no CPP file) ...
Hello,
This guy:
virtual phTreeClass* GetTreeClass() const { return (phTreeClass*)m_entity_class; }
When called, crashed the program with an access violation, even after a full recompile. All member functions and virtual member functions had correct memory adresses (I hovered mouse over the methods in debug mode), but this function h...
When creating prototype classes I lay out the destructor as such:
virtual ~MyClass();
When finalizing the class in a library I noticed that I cannot add 'virtual'. Is this normal, and is virtual taken into consideration or am I do something wrong?
For example; when I try to do this I get a compiler error:
virtual MyClass::~MyClass()...
I have an ASP.NET MVC web application running in IIS as a subweb; let's say its path is something like http://mysite.com/subweb.
I have a view which serves content obtained from a CMS. The CMS editor has entered some content containing a relative image path <img src="/images/imga.png" />.
This works fine on the production server where...
I was asked this crazy question.
I was out of my wits.
Can a method in base class which is declared as virtual be called using the base class pointer which is pointing to a derived class object?
Is this possible?
...
I have a base class called Element, a derived class called Vector, and I'm trying to redefine two virtual functions from Element in Vector.
//element.h
template <class T>
class Element
{
public:
Element();
virtual Element& plus(const Element&);
virtual Element& minus(const Element&);
};
and in another file
//Vector.h
#include "Eleme...
I am writing an abstract superclass where literally every method is going to be overridden. There is some default functionality I could implement, but most of the time it's enough to leave the implementation to the subclass writer.
Since just about every method is going to be overwritten, how much should I make virtual and how much sho...
I am trying to print the address of a virtual member function.
If I only wants to print the address of the function I can write:
print("address: %p", &A::func);
But I want to do something like this:
A *b = new B();
printf("address: %p", &b->func);
printf("address: %p", &b->A::func);
however this does not compile, is it possible t...
I was curious about C++ and virtual inheritance - in particular, the way that vtable conflicts are resolved between bass and child classes. I won't pretend to understand the specifics on how they work, but what I've gleamed so far is that their is a small delay caused by using virtual functions due to that resolution. My question then is...
I would like to add 1,000,000+ entries to the root node of a TreeListCtrl. Therefore I would like to make it "virtual", i.e. work just like a virtual ListCtrl so that it's still fast and I can easily scroll around due to the currently-displayed items being loaded on-demand. But I can't use a virtual ListCtrl because I also want to be abl...
I have been reading documentation describing class inheritance, abstract base classes and even python interfaces. But nothing seams to be exactly what I want. Namely, a simple way of building virtual classes. When the virtual class gets called, I would like it to instantiate some more specific class based on what the parameters it is giv...
I am running a bit of code that looks like this:
result = system("ruby " + filename_random_ruby_script)
if result
save_to_disk(random_ruby_script)
else
# Do Nothing
end
The variable "random_ruby_script" represents any .rb file.
This code is the first of many calls to system() and runs a ruby file that may also contain calls to sy...
Coming from a C++ background, this came as a surprise to me. In C++ it's good practice to make virtual functions private. From http://www.gotw.ca/publications/mill18.htm: "Guideline #2: Prefer to make virtual functions private."
I also quote Eric Lippert's blog, from http://blogs.msdn.com/b/ericlippert/archive/2010/03/25/knights-knaves-...
Hi,
I have a network management software which profiles network devices based on their MAC addresses. I want to write a tool to stress test this software by using virtual MAC addresses (simulate thousands of devices each having a different MAC address). I played around with WinPCap and found that I can send a packet with spoofed up MAC...
I want to do the following:
class ErrorBase
{
public:
void SetError(unsigned errorCode)
{
mErrorCode = errorCode;
}
char const* Explanation(unsigned errorCode) const
{
return errorExplanations[errorCode];
}
private:
char const* errorExplanations[];
unsigned mErrorCode;
};
class MyErro...
I've downloaded and installed the Microsoft Virtual PC and Windows XP mode image for testing IE6. I have several projects on localhost that I access by port numbers in my vhosts file, for example:
Listen *:82
<VirtualHost *:82>
DocumentRoot "path/to/htdocs/project-folder/public/"
</VirtualHost>
In the virtual machine I have change...
Hi guys, please help me, I am pulling my hair out. I cannot get Virtual Hosts to work with WAMP. I have uncommented out this line:
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
This is my httpd-vhosts.conf file:
#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHos...
I set up a (perhaps very unscientific) small test to determine the overhead of virtual functions in a one-level single inheritance and the results I got were, well, exactly the same when accessing the derived class polymorphically or when accessing it directly. What was a bit surprising was the order of magnitude of computation time that...
Hello there,
I have something like that (simplified)
class A
{
public:
virtual void Function () = 0;
};
class B
{
public:
virtual void Function () = 0;
};
class Impl : public A , public B
{
public:
????
};
How can I implement the Function () for A and the Function() for B ?
Visual C++ lets you only define the s...
This has probably been asked before on SO, but I were unable to find a similar question.
Consider the following class hierarchy:
class BritneySpears
{
public:
virtual ~BritneySpears();
};
class Daughter1 : public BritneySpears
{
public:
virtual ~Daughter1(); // Virtual specifier
};
class Daughter2 : public BritneySpears...