- Upvotes Received
- 0
- Posts with Upvotes
- 0
- Upvoting Members
- 0
- Downvotes Received
- 4
- Posts with Downvotes
- 4
- Downvoting Members
- 1
14 Posted Topics
Re: In Example 11, i expected the virtual ptr for derived class to be at [CODE] (int *)*((int *)(&obj)+3) [/CODE] Hpwever, the VPTR is at [CODE] (int *)*((int *)(&obj)+0) [/CODE] Can some body explain this please? Thanks in advance ! | |
[code] class A { public: A() { cout<<"ctor A\n"; } virtual void func(int x) { cout<<"\nsj\n"; } }; int _tmain(int argc, _TCHAR* argv[]) { A objA; int *vptr = (int *)*((int *)&objA);// address of the virtual table typedef void (*fnptr)(int); fnptr f; f = (fnptr)*((int *)vptr+0);// address of func() within … | |
Hi i am trying to write a script to match a '' at the END of the line. For eg. i have a file Temp1 which contains :- [code] a = b + c \ +d; printf("\n"); [/code] Objective: To match the '' in the 1st line and NOT the … | |
hi all i want to add a pattern (say XYZ) after variable $lineNum in some tempFile. How do i do this, preferably using sed ? for eg. Initially line 1 line 2 Later line1 my pattern line2 | |
if line 5 of a file needs to be replaced with contents of $line, how could we possibly do this using sed ? | |
My input file looks like this [code] abc def \ ghi jkl && mno || hju [/code] My objective: to replace '' with line 2 newLine=`sed -n "2 p" inputFile` sed -n 's/\\/'"$newLine"'/p' inputFile | tee inputFile When i do this, the output i get is -> abc def abc … | |
[CODE] class A { int x; public: A(){} ~A() { cout<<this<<endl<<"bye"<<endl; } }; int main() { A a; a.~A();//bye return 0; // after return 0, destructor will be called and bye will be printed again } [/CODE] the destructor gets called twice. The 1st time, its explicitly called and the … | |
what is the difference between a class declaration and a class definition ? Is it that a class which contains the prototypes of member functions is a class declaration? Is it that a class with member functions defined within the class , is a class definition ? | |
why is the size of an empty class 1 byte ? does the compiler add some null byte ? | |
[CODE] class Base { public: virtual void fn(){cout<<"fn base\n";} virtual void myfn(){cout<<"myfn base\n";} }; class Derived : private Base { private: void fn(){cout<<"der\n";} void myfn(){cout<<"myfn Derived\n";} }; int _tmain(int argc, _TCHAR* argv[]){ Derived d; Base *p = &d; //Error: conversion from derived * to base * exists but is inaccessible … | |
how many processes will be created when i fork() twice . Is this logic correct ? the 1st fork will spawn child C1 which is a child of the parent process P. the code segment of the parent P is inherited by C1. the 2nd fork is called by both … | |
i have two classes. One is room and the other is container.[B]Room is the class which you write, container is a 3rd party class, you can't change the class definition of container.[/B] in the constructor of container, large amount of memory is allocated. In the ctor of room, a small … | |
This one is on References. [url]http://publib.boulder.ibm.com/infocenter/comphelp/v8v101/index.jsp?topic=/com.ibm.xlcpp8a.doc/language/ref/cplr110.htm[/url] in the above link (from IBM), they clearly mention that a reference to a (pointer to a reference ) is not allowed.They also say that a reference to other references is not allowed. However, when i tried out both these cases in code, it … | |
When an object is instantiated, the constructor gets called ? How is this internally implemented ? Who Calls the Constructor ? Is it the OS ? |
The End.