• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Really Quick C++ Question - Thanks!

Kenji4861

Banned
1
I'm trying to understand this class and this is what I see

function(){
/*some function*/
}

function(int i){
/*some function*/
}

~function(){
/*some function*/
}

If I want to send in a string of numbers to function. Is it possible?
 
~function() is an object/class destructor called when the objects is deleted so it can perform its own post-deletion steps such as freeing dynamically allocated memory

To check for a negative number:

if(num < 0)
{
cout << "negative number\n";
}
else
{
cout << "0 or positive number\n";
}
 


<< Thanks Singh, I don't know why I couldn't think of that negative number method. Anyways, here's another C++ question. >>



What question?
 
I have to send in a HUGE number, bigger than an unsigned int into these functions. The way I can think of is sending a string into the function, but one of them has no argument, one of them takes in an int as an argument, and the other is a destructor. So is this possible?
 
Please clarify exactly what you mean. Can't you change the function(s) to your needs? How big is the number? You can't send anything to a destructor or a function that has no parameters.
 
sure, just write yourself another one

function((ap)string string){
/*some function*/
}

Don't forget to put the prototype in the class header.
If you use regular strings, take out the ap in the argument, otherwise leave it in for apstring
 
Back
Top