Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
0% Quality Score
Upvotes Received
0
Posts with Upvotes
0
Upvoting Members
0
Downvotes Received
4
Posts with Downvotes
4
Downvoting Members
1
0 Endorsements
~5K People Reached
Favorite Forums
Favorite Tags
Member Avatar for asadullah

Assumption: 32-bit Machine. Here I am going to explain How Virtual table, Virtual pointer for Virtual functions are internally working. First we have understand memory layout. Example 1: How the class's memory layout Code: cpp [code=cpp] class Test { public: int data1; int data2; int fun1(); }; int main() { …

Member Avatar for kresimir
0
3K
Member Avatar for kneiel

[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 …

Member Avatar for AliceJohn123
0
677
Member Avatar for kneiel

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 …

Member Avatar for cfajohnson
-1
876
Member Avatar for kneiel

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

Member Avatar for sknake
-1
57
Member Avatar for kneiel
Member Avatar for cfajohnson
-1
86
Member Avatar for kneiel

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 …

Member Avatar for kranny
-1
88
Member Avatar for kneiel

[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 …

Member Avatar for vijayan121
0
82
Member Avatar for kneiel

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 ?

Member Avatar for grumpier
0
380
Member Avatar for kneiel

why is the size of an empty class 1 byte ? does the compiler add some null byte ?

Member Avatar for mitrmkar
0
72
Member Avatar for kneiel

[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 …

Member Avatar for Alex Edwards
0
161
Member Avatar for kneiel

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 …

Member Avatar for Salem
0
87
Member Avatar for kneiel

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 …

0
46
Member Avatar for kneiel

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 …

Member Avatar for kneiel
0
115
Member Avatar for kneiel

When an object is instantiated, the constructor gets called ? How is this internally implemented ? Who Calls the Constructor ? Is it the OS ?

Member Avatar for kneiel
0
94