Hi guys, I would like to discuss my design with one query. below is the code snippet. It is clear from below code snippet that class pd is privately derived from AbstractClass as both are different classes and there is no relation between them.Now in my class pd i need ConcreteClassB's service call to proceed further for my version of do_servicecall function so i have overridden the same. Now if you see the do_servicecall functionimplementation inside pd class then you will realize that through servicecall function(defined in AbstractClass) i am able to overide the implementation provided by ConcreteClassB . Here …

Member Avatar
Member Avatar
+0 forum 9

the virtual Methods concept is very difficult concept. In c++ when we want to implement polymorphism then we use virtual function. But in the case of java i read that all methods in java are virtual by default except final methods that can not be overridden. I am confuse about polymorphism and virtual functions. Why methods in java are virtual by default and why not in c++. This is my basic question. Please help me. First of all tell me what is virtual functions. and how can we prove that methods in java are virtual by default. i want proof …

Member Avatar
Member Avatar
+0 forum 5

i know that in polymorphism when we not use virtual function then the compiler is execuite member function according to pointer type and when we use virtual function then compiler execute member function according to the type of object My question is that WHY it is happnes what is the functionality of virtual function that force the compiler to execute member function according to type of object. what is the logic in virtual function plz answer my question

Member Avatar
Member Avatar
+0 forum 1

hmm, think I figured it out

Member Avatar
+0 forum 0

Hello everyone I am facing a problem that I have never encountered before and googling around just isn't helping. I was assigned to migrate a pmWiki server to a new MediaWiki server which was supposed to run as a virtual machine on a Red Hat Cluster Suite. My coworker and I had to copy paste almost 2000+ articles. During the migration my coworker decided to make a backup script with which he effectively deleted the libc library and many other important data. We copied the image of the Hard Drive in order to extract the database of our wiki but …

Member Avatar
Member Avatar
+0 forum 2

I have the following structure: CObject { protected: char *mName; public: CObject(char *n) { mName=strdup(n); } }; CVector:public CObject { char *mValues[50]; int mElements; public: CVector(char *n):CObject(n) {} }; CMatrix:public CObject { char *mValues[50][50]; int mLines; int mColumns; public: CMatrix(char *n):CObject(n) {} }; My main function: int main() { pV=new CVector("Vector 1"); pM=new CMatrice("Matrice 1"); delete pV; delete pM; } As you can see, i want to explicitly call them.

Member Avatar
Member Avatar
+0 forum 12

Hello, I have a chain of inherited classes like this: class A { protected: int a; public: int getA(){return a;} }; class B:public A { protected: int b; public: int getB(){return b;} }; Based on that you can see that the public can only read the values in those classes, they cannot write them. However I would like to make a sort of overriding class that will allow those with access to it to modify the classes, like so: class ExposedA:public A { public: ExposedA &setA(int a){this->a=a;return *this;} }; //here is where I am lost class ExposedB:public B { public: …

Member Avatar
Member Avatar
+0 forum 7

Hello, I have some java code I want to port to C++, and first class in the Heirarchy has me stumped. I'm trying to port a simple parsing framework as an exercise to figure out how it works internally, and almost everything in the framework requires, uses, or is `PubliclyClonable` a class defined in java as: public abstract class PubliclyCloneable{ public abstract Object clone(); } As C++ has no Object class I wanted to define the C++ version like this: class Cloneable{ virtual Cloneable clone()=0; } Visual Studio Intellisense says this isn't allowed, and I don't have a .cpp to …

Member Avatar
Member Avatar
+0 forum 2

I am attempting to host multiple sites on a single server by using virtual hosts however I am having a bit of an issue. A bit of info before I begin, -I am using Ubuntu Server 12.04 -I am using Apache2 -I have two domains and two sites, stored in /var/www/site1 and /var/www/site2 I have put this in my httpd.conf file and from what I understand it should have worked, allowing domain1 to go to site1 and domain2 to go to site2 but instead domain1 and domain2 go to site1 only. NameVirtualHost *80 <VirtualHost *:80> DocumentRoot "/var/www/site1" ServerName domain1.com ServerAlias …

Member Avatar
Member Avatar
+0 forum 6

I am attempting to setup virtual hosts so that I can host multiple sites on Apache2. I have currently got two files in my /etc/apache2/sites-available folder, each containing the following: <VirtualHost *:80> ServerName www.domain.com ServerAlias domain.com DirectoryIndex index.php DocmentRoot /var/www/domain </VirtualHost> Obviously the 'domain' changes to the domain for the two websites I am trying to host. The problem is that when I go to domain.com and then domain2.com it only loads up domain.com in both examples... Please could someone suggest what is going on? I am using Ubunt 12.04 Thanks

Member Avatar
Member Avatar
+0 forum 1

Hey! for a school project, came to me the following question: the libopenmetaverse is more directed to any of the components of the MVC (model, view, controller) or apply to any of them? someone can help me with this? thanks

Member Avatar
Member Avatar
+0 forum 2

Hello, I need to update my older Autodesk plug-in. And I am having troubles get it through. (They changed one function) This is a new definition which I cannot change: [CODE] CoreExport virtual void EnumAuxFiles(AssetEnumCallback& assetEnum, DWORD flags);[/CODE] And here is my code: [CODE] class CheckFileNames: public AssetEnumCallback { public: NameTab* missingMaps; BitmapInfo bi; CheckFileNames(NameTab* n); void RecordName(TCHAR *name); }; CheckFileNames::CheckFileNames(NameTab* n) { missingMaps = n; } int LoadMapFiles(INode* node, SContext* sc, MtlBaseLib& mtls, TimeValue t) { NameTab mapFiles; CheckFileNames checkNames(&mapFiles); // HERE is the bug //error C2259: 'CheckFileNames' : cannot instantiate abstract class node->EnumAuxFiles(checkNames, FILE_ENUM_MISSING_ONLY |FILE_ENUM_1STSUB_MISSING); } [/CODE] My …

Member Avatar
Member Avatar
+0 forum 11

#include<iostream> using namespace std; class area { double dim1, dim2; public: void setarea(double d1, double d2) { dim1= d1; dim2 = d2; } void getdim(double &d1, double &d2) { d1 = dim1; d2 = dim2; } virtual double getarea() { cout<<"You must override this functionn"; return 0.0; } }; class rectangle : public area { public: double getarea() { double d1, d2; getdim(d1, d2); return d1*d2;; } }; class triangle : public area { public: double getarea() { double d1, d2; getdim(d1, d2); return 0.5*d1*d2; } }; int main() { area *p; rectangle r; triangle t; r.setarea(3.3, 4.5); t.setarea(4.0, 5.0); …

Member Avatar
Member Avatar
+0 forum 7

Hi :) i am new in C# and i am a little confused with the abstruct, virtual and override terms in C#... why they are good for? i tried to google it but i got more confused... for example - i am making a chess program and i made a class "piece" and other classes for pawn, knight, bishop etc. that inherit from piece now, i wanna to made a "LegalSquares" function that show me all the legal squares on the board - ofcourse it will be different between the pieces what is the right way to do it? make …

Member Avatar
Member Avatar
+0 forum 1

I have been reading the 'inside the c++ object model' by Lippman and one of the sections has me a little confused. It is the section where the author explains how virtual tables are created and virtual pointers assigned, in the scenario of multilevel, single inheritance. If anyone here has the book i'm referring to the diagram on page 129, figure 4.1 (I think there's only 1 edition) and the statement mentioned on the next page that if a derived class adds a new virtual function, a slot is added to the end of virtual table which contains the address …

Member Avatar
Member Avatar
+0 forum 9

Today I was taught about virtual methods but got lost somewhere in the pointers. Here is an example [CODE] class Person { protected: string name; public: virtual string get_name() { return name; } }; class TFaculty:public Person { private: string title; public: virtual string get_name() { return title + " " + Person::get_name(); } }; [/CODE] [CODE] int main() { Person *arr[2]= { new TFaculty("Jane Doe", "Dr."), new TFaculty("John Doe","Mr.") } return 0; } [/CODE] My code might be incomplete as I can't remember all of it. What I'm confused about is that I have a two element array pointing …

Member Avatar
Member Avatar
+0 forum 5

I am learning c++ now and have encountered a problem in trying to create single digit addition, multiplication and subtraction math questions. The numbers used in the questions are randomly generated from 1 to 9 and when I try to print the answer for the corresponding question, I get a 0 for it which is not correct. The following are my codes. I would be very grateful if someone can give me some pointers on my code. If you have any suggestion in how I can improve my coding, I am very open to it. Thank you.[CODE] #include <iostream> #include …

Member Avatar
Member Avatar
+0 forum 1

I need a few helps for some things that I just cannot get the syntax of! (I need these, and if you don't believe me I can post the reason) 1) Creating a function within a function 2) Creating a class within a function 3) Declaring a template function outside a class EXAMPLES: 1)[CODE]typedef void(*FUNC)(); FUNC GenFunc() { FUNC ret=;//HELP! I NEED TO MAKE A FUNCTION return ret; }[/CODE] 2)[CODE]class Abstract { public: virtual void do()=0; } Abstract &getClass() { Abstract &ret=;//HELP! I NEED TO MAKE A CLASS DERIVED FROM Abstract return ret; }[/CODE] 3)[CODE]class Thing { public: template <typename …

Member Avatar
Member Avatar
+0 forum 4

I am working on making a 'safetype' abstract class, which will have a complete set of pure virtual operator overloads to help make sure that a class inherited from it is safe to pass to virtual any function. The problem is that I don't know the syntax of a pure virtual operator overload or if any of the operators are unable to be virtualized. Can somebody give me an example of how to write a pure virtual operator, as well as list any operators that cannot be made purely virtual?

Member Avatar
Member Avatar
+0 forum 2

Hi, I have a Toshiba NB300 laptop running win7, and I'm trying to run some software that requires a screen res of at least 1024x700. Unfortunately, the max res of this laptop is 1024x600. I have searched the web looking for a solution for this, people with similar issues had been advised to uncheck the 'Hide modes that this monitor cannot display' button in the properties menu, or reduce the screen refresh rate however these appear to be disabled. I understand that the quality might be reduced significantly but is there any work around besides returning my laptop? I don't …

Member Avatar
Member Avatar
+0 forum 7

[code] public class Animal { public void eat() { System.out.println("I eat like a generic Animal."); } public static void main(String[] args) { } } class Fish extends Animal { @Override public void eat() { System.out.println("I eat like a fish!"); } } class Goldfish extends Fish { @Override public void eat() { System.out.println("I eat like a goldfish!"); } } [/code] In this example how to call the 'eat' method of the Animal class using an object of class GoldFish? [code] GoldFish gfobj = new GoldFish(); gfobj.eat();//i'm expecting this line to call the eat method in the Animal class [/code] however i'm …

Member Avatar
Member Avatar
+0 forum 1

I have a design question which I have not been able to find a satisfactory answer for by searching. Essentially, I have a class - Base - that contains a vector of pointers to another class - Node. However, I would like to be able extend both the Base and Node class. This will involve adding new variables and functions to the classes derived from Node, and utilising these additional functions in classes derived from Base. I can think of a few ways to accomplish this, but am unsure which is the best from a design point of view, as …

Member Avatar
Member Avatar
+0 forum 9

Hi, I want to develop a an application based on independent "CustomModule" that all derived from a base class "BaseModule" and that can send different kind of "CustomEvent" (derived from a "BaseModule" class) to each other. Each Module just knows that it is connected to others "BaseModule" (i.e. it does not know the specific type of "CustomModule" they are). So the problem is the following: How can I specialize the code of CustomModule depending on the CustomEvent type that it receives and in the same time keeping a generic interface communication between Modules ? A precision: this code have to …

Member Avatar
Member Avatar
+0 forum 3

I running my little blog on Tomcat 6 server. My hosting company allows me to set up multiple sub domains. I was trying to do for last few hours, but no luck. Having started with [code=xml] <Engine name="Catalina" defaultHost="mydomain.co.uk"> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> <Host name="mydomain.co.uk" appBase="/home/user/public_html" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false"> <Alias>www.mydomain.co.uk</Alias> <Context path="" reloadable="true" docBase="/home/user/public_html" /> <Context path="/manager" docBase="/usr/local/tomcat/users/user/tomcat/webapps/manager" privileged="true" antiResourceLocking="false" antiJARLocking="false" reloadable="true" /> </Host> </Engine>[/code] I added new host to engine as [code=xml] <Host name="code.mydomain.co.uk" appBase="/home/user/code_public_html" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false"> <Alias>code.mydomain.co.uk</Alias> <Context path="" reloadable="true" docBase="/home/user/code_public_html" /> </Host>[/code] I tried to also follow Virtual Hosting and Tomcat [URL="http://tomcat.apache.org/tomcat-6.0-doc/virtual-hosting-howto.html"]1[/URL] and [URL="http://www.ex-parrot.com/pete/tomcat-vhost.html"]2[/URL] (2nd …

Member Avatar
Member Avatar
+0 forum 1

Hello everybody. I wanted to ask what does exactly Win7 do with their so called xp mode. As i have seen from various clips, this "mode" is actually just a virtual machine that runs win XP. Am i right? If the answer is yes then how come not all processor can support the "mode"? I mean, a virtual machine is just a program that creates/assigns virtual resources for a process, isn't it? What is so special then about this xp virtualization that not all processors can support? Secondly, when a distinct program is run from xp mode (but without xp's …

Member Avatar
Member Avatar
+0 forum 13

The End.