Reputation: 793
Problem: I have a function that gets passed data and a size.
But I want another function dedicated to "getting the size" so i can call it and find out what it is.
Is there any way to point to what is passed into my function (the one passed data and size) and bring the size to my GetSize function so it can return size??
CommonClass::Do something(void* data, unsigned long size) // Is what I have
I want to use the same unsigned long size used when do something was called for my GetSize function CommonClass::GetSize(
Thanks all!
Upvotes: 0
Views: 200
Reputation: 12215
Make a class variable that contains size, something like:
In class.cc
int getSize()
{
return size_;
}
void func(int data, int size)
{
size_ = size;
}
In header.h
int size_;
Upvotes: 3