In C++, a function template specialization is supposed to act exactly like a normal function. Does that mean that I can make one virtual? For example:
struct A
{
template <class T> void f();
template <> virtual void f<int>() {}
};
struct B : A
{
template <class T> void f();
template <> virtual void f<int>() {}
};
int m...
I'm wondering how the following code is optimized. Specifically concerning virtual and direct calls. I have commented on how I think everything is optimized but those are just guesses.
public abstract class Super
{
public abstract void Foo();
public void FooUser()
{
Foo();
}
}
public class Child1 : Super
{
...
Is it possible to create a virtual composite using SWT, i.e. one could scroll horizontally or vertically beyond the maximum display area of the composite?
I want the length and height of my widgets (images) to stay constant regardless what size the composite is changed to.
If there are 50 images to display and only 10 can be viewed at ...
Hi, I was wondering if any of you guys knew of a space efficient way of storing non overlapping intervals. My end goal is to use this to allocate virtual address space (I am writing an operating system for fun) and wanted to know if one could store the regions of free space in better than O(n) space complexity and O(n) search complexity....
Hello all :)
I've got a large set of inherited classes (criteria) which inherit from a base class (criterion). Here's criterion's code
class criterion
{
public:
virtual unsigned __int32 getPriorityClass() const = 0;
virtual BOOL include(fileData &file) const = 0;
virtual void reorderTree() = 0;
virtual unsigned int dire...
I was asked in an interview that what is the usage of virtual keyword with a class declaration in C++ and I answered that virtual keyword cannot be used with a class declaration in C++. The interviewer said that it is possible and asked me to test it later.
Now that I have checked it myself I have come to know that this is possible and...
What does it mean when "virtual" is in "class Foo : public virtual Bar" as opposed to "virtual void frob()"?
For a given method there are 8 cases stemming from the presence or absence of virtual in the following three locations.
A superclass's functions.
The inheritance chain for this class.
This classes functions.
I think I underst...
Suppose I have virtual function foo() in class B, and I need slightly different behavior in one of B's derived classes, class D. Is it OK to create an overriding function D::foo(), and call B::foo() from there, after the special case treatment? Like this:
void D::foo()
{
if (/*something*/)
// do something
else
B::foo();
}
...
Hello all,
Here is my situation: I have a PHP base class that looks something like this:
class Table {
static $table_name = "table";
public function selectAllSQL(){
return "SELECT * FROM " . self::$table_name;
}
}
And a subclass that is like this:
class MyTable extends Table {
static $table_name = "my_table";
}
Unfort...
Hi all,
I've found a way to create virtual desktops with c#. Now I was wondering if we can take a screenshot of a particular desktop and if so how ?
Thanks in advance
Blizz
...
How do I know the the complete virtual path that my application is currently hosted? For example:
http://www.mysite.com/myApp
or
http://www.mysite.com/myApp/mySubApp
I know the application path of HttpRequest but it only returns the folder name that my application is currently hosted, but how do I get the initial part?
...
Hello,
Here is my program:
I'm uploading an image(Stream, FileInfo or whatever you like) to a server at this virtual directory: "C:\_Resources\Assets"
But then, I want the server to return the UNC path of that image to display it in an tag, that is to say "http://localhost/Trunk/Assets/image.jpeg"
In fact, I'm trying to do the opposi...
I have to load modules as dlls dynamically at runtime as they are not known ahead of time, just that they conform to a class interface. What I noticed is that after I catch an exception thrown by the dll (in the main program in the main thread), the right destructors are called and the modules destroyed and dll's unloaded, but then as t...
While playing with implementing a virtual assignment operator I have ended with a funny behavior. It is not a compiler glitch, since g++ 4.1, 4.3 and VS 2005 share the same behavior.
Basically, the virtual operator= behaves differently than any other virtual function with respect to the code that is actually being executed.
struct Base...
Hi,
I am trying to investigate the behaviour of the Windows Kernel with respect to Memory Mapped Files / Virtual Memory. Specifically I am interested in determining how frequently the contents of a memory mapped file are flushed (by Windows) to disk and what criterion Windows uses for deciding it is time to do so.
I have done a bit of ...
I have my /etc/postfix/virtual file:
sub.domain.com DOMAIN
@sub.domain.com user2
domain.com DOMAIN
@domain.com user1
The mail for @sub.domain.com still goes to user1 and that's not what I want.
Here's my /etc/postfix/my.cnf just in cases:
mydomain = domain.com
myhostname = mail.domain.com
alias_maps = hash:/etc/aliases
alias_databas...
if I had 2 managed switches with vlans configured like:
Switch 1:
Server - Vlan 1 2 3
Desktop - Vlan 1
Switch 2:
Desktop - Vlan 2
Desktop - Vlan 2
Access Point - Vlan 3
Switches are connected through 2 gigabit uplink ports
would every desktop / wireless client see the server?
(im not sure if you ...
I would like to use Virtual Earth on an ASP.NET MVC application for a client. What are the licenses available for commercial use?
Also, does anyone have a good example? I tried a few examples but they always end with 'Object is null' error in the java script code.
Thanks in advance.
...
If we define a abstract class which has a pure virtual destructor, why do we have to give a definition of a destructor in the abstract class?
...
I have a C++ application that can be simplified to something like this:
class AbstractWidget {
public:
virtual ~AbstractWidget() {}
virtual void foo() {}
virtual void bar() {}
// (other virtual methods)
};
class WidgetCollection {
private:
vector<AbstractWidget*> widgets;
public:
void addWidget(AbstractWidget* widget) {...