Hello there, until now i am still confused about this one, i mean what for we cast the child class to parent class?.. since child class can access all of the member of the parent class, yeah since its has public modifier..
And also, we can cast the parent as a child using dynamic_cast right?.. but what for?..
I still relly confused about pointer interaction, why we need access the pointer thingy..
Thx...
Search Result
Collapse
26 results in 0.0032 seconds.
Keywords
Members
Tags
-
Type Cast Pointer, Child and Parent Interaction
-
convert double* to float*
Hi guys,
I have written a library that manipulates data stored in double arrays. It took months to fine tune it and here it is, working fine. Everything was great until I started integrating my project with another open source project that uses float arrays. I need to pass my double arrays to the function that requires float arrays.. I am out of ideas how to do that.. I would like to avoid re-writing my project to use float instead... -
Pointer gets lost when calling one construction from another
A constructor to a class takes some arguments including a pointer which is assigned to a class variable. The constructor then calls a default constructor, but inside the default constructor the pointer is no longer valid.
some code should illustrate.
Code:Feature::Feature(){ cout<<"at b "<<oc<<endl; cout<<"b is "<<oc->geoSphere->getNumVs()<<endl;
-
Liam Kurmos started a topic Why do i have to assign this iterator pointer to a variable before i can use it?in CWhy do i have to assign this iterator pointer to a variable before i can use it?
im using g++ on ubuntu 10.10
i have a pointer to a vector of pointers to objects and i want to call a method on each of those objects.
oc->features is defined as:
vector<Feature* >* features;
i have to do:
Code:vector<Feature*>::iterator it; for (it=oc->features->begin();it!=oc->features->end();it++){ Feature* a=*(it);
Last edited by Niheel; Feb 9 '11, 05:08 PM. -
How to return arrays from function using pointer_segmentation fault?
Code:#include<stdio.h> #include<stdlib.h> int **array(); main() { int **result=array(),i,j; //display result for(i=0;i<2;i++) printf("\n"); for(j=0;j<2;j++) printf("%d \t",result[i][j]); } //function int **array() {
-
Java GUI Static component, NullPointerException
Hey everyone, I created a GUI project, where I'm using a JTree. When it's created everything is ok, but in my run() method when I call it i get a nullPointerExce ption. Here is the code.
Code:treePanel = new javax.swing.JPanel(); DefaultMutableTreeNode top = new DefaultMutableTreeNode("blah"); mytree = new javax.swing.JTree(top); javax.swing.GroupLayout treePanelLayout = new javax.swing.GroupLayout(treePanel);
-
How to fix errors relating to pointers in C?
I am getting a warning and a common error in my code, and I need help understanding them.
The warning is:[Warning] assignment makes pointer from integer without a cast
Here is the code that i get the warning from:
Code:line1 = biset_new(MAX_STRING); line2 = bitset_new(MAX_STRING); bitset_un = bitset_new(MAX_STRING); bitset_in = bitset_new(MAX_STRING);
-
Converting C# Byte Pointer into VB.NET
I'm currently coding a for fun version of a texture transfer tool from a paper i read from SIGGRAPH'01..i' ve figured out most of the coding based on the C# i found somewhere but I'm having trouble with its conversion into VB.NET.
my line
Code:Dim ptr As Pointer(As Byte) = CType(CType(bmpData.Scan0, Pointer(Of System.Void)), Pointer(Of Byte))
-
Converting VOID* to INT ON C/C++
In the past couple of days i have noticed that a lot of people are having problems casting from one data type to another specially from void to char or int.
First of all void* just means that the variable can pretty much hold any type of data, from character all the way unto float. Let me just show you >>
Lets say you want void *variable;
to be equal 100;
Code:void *variable = 100;
-
operator[] does not work
Hello!
I have a homework for tomorrow, and I simply can't solve it.
I have a list (with template) class, I wrote and it has an operator:
Code:T& operator[](int i) { ToFirst(); for(int j=0;j<i;j++) { StepForward(); } return Act->value; }
And I've...Last edited by Markus; Nov 16 '10, 01:00 PM. Reason: Added [code] tags, undeleted thread and moved it to /c/answers/ -
Rizladonovich started a topic Is ((char **) &var_name); a cast to char array giving existing pointer to var_name?in CIs ((char **) &var_name); a cast to char array giving existing pointer to var_name?
I am currently reading/learning c. I often like to look at code while I read, - to see more practical use then often are feasible in educational books.
I am looking at some code from wget.
Code extracted from wget.
Code:/* file: mswindows.c */ void windows_main (char **exec_name) { char *p; /* Remove .EXE from filename if it has one. */ *exec_name = xstrdup
-
David727 started a topic Why is the gap between an address of a file pointer, to the one after it, is only 32in CWhy is the gap between an address of a file pointer, to the one after it, is only 32
#include<stdio. h>
char garb;
FILE *f ,*g;
int main(){
f=fopen("try1.t xt","wt");
g=fopen("try2.t xt","wt");
printf("f is equal to %ld\n",f);
//the result is 2009464032
printf("g is equal to %ld\n",g);
//the result is 2009464064
//I... -
Trouble understanding "Double" Pointers.
I am a student and I am having trouble understanding Dynamic Memory Allocation and the usage of Double Pointers.
Code:int **A A=(int **)malloc(r1*(sizeof(int*))); for(i=0;i<r1;i++) A[i]=(int *)malloc(sizeof(int)*c1)
My question : What does the malloc function do here? I know malloc()... -
Passing a pointer to a function ... how?
Hi all
I'm doing my first steps in C and I need some help plz.
I have 2 structs, a node* and a stack*. I want to write a push() function that accepts to arguments, the node to insert and the pointer to the the top of the stack.
This way it works without problems: push(node *theNode, stack *theStack)
The call looks like that: push(newNode, newStack) and inside the function I can access the pointer... -
import unmanaged dll into c sharp
hi,
i'm trying to import an unmanaged dll into a c# application. The dll is given to me but i'm new with dll import thing and having some troubles importing it. Dll comes with a pdf file which describes the functions but all parameters and types are c++ type and i need to write them as c# types. i tried "Dllimport" but i think i couldn't write the correct parameter types. Functions use handles and pointers which doesn't make it easier...Last edited by tlhintoq; Apr 25 '10, 04:41 PM. Reason: [CODE] ...Your code goes between code tags [/CODE]