I have this snippet of the code
Account& Company::findAccount(int id){
for(list<Account>::const_iterator i = listOfAccounts.begin(); i != listOfAccounts.end(); ++i){
if(i->nID == id){
return *i;
}
}
return 0;
}
Is this right way to return 0 if I didn't find appropriate account?
cause I receive an error:
no match for 'operator!' in '!((Company*)this)->Company::findAccount(id)'
I use it this way:
if(!(findAccount(id))){
throw "hey";
}
thanks in advance
For example,I click button and then on the form appears GroupBox with some controls inside.One more click-one more GroupBox.This may lasts to infinity.Please,tell me how to do that???
I'm a beginner and I want to write Java code in eclipse. This program takes two LinkedLists of integers (for example, a and b) and makes a LinkedList (for example d) in which every element is the sum of elements from a and b. However, I can't add these two elements from a and b because they are Objects
Example:
a=[3,4,6,7,8]
b=[4,3,7,5,3,2,1]
------
d=[7,7,13,12,11,2,1]
class base {
public:
virtual void doSomething() = 0;
};
class derived : public base {
**private:**
virtual void doSomething(){cout<<"Derived fn"<<endl;}
};
now if i do the following:
base *b=new child;
b->doSomething(); //it calls the derived class fn even if that is private.
Question:
1.its able to call the derived class fn even if that is private.How is it possible?
Now if i change the inheritance access specifier from public to protected/private then i get compilation error as "'type cast' : conversion from 'Derived *' to 'base *' exists, but is inaccessible"
Notes: I am aware on the concepts of the inheritance access specifiers.So in second case as its derived private/protected, its inaccessible. But here it confuses me for the first question. Any input will be highly appreciated
Hi,
Reading some article about singleton, I stopped at the point saying: "Do not allow to crate copy of existing instance".
I realized that I do not know how would I do that! Could you tell me, please, how could I copy existing instance of class?
And the second one: deserializaition. How it could be dangerous?
And for both - how to deny creating copies or deserialization?
Thanks
I'm trying to build an iPhone app where I have a list of names, and can search by year to find the top ten names for that year. How would I need to set that up in xcode?
Hi Guys,
I'm building a part of a system where the user can define "views" from a mysql database.
I want some way of generating simple HTML tables/reports from the data, but not just plain output of sql queries- simple joins probably isn't enough.
Any ideas?
Okay so have a database that uses the time functions for a list of events and then displays the data as:
echo "<b>Time Frame:";
echo "$time_start"; echo " - "; echo "$time_end";
Although that displays the time as 11:00:00 if i want the time to be 11:00 am. Is there anyway to make this time display as a standard "11:00"? and also if in the mysql datababse enter it as military time (ex. 13:00) to make it display 1:00pm?
I have tried many things. Please help.
http://pastebin.com/kaTZzGrx
I have several worksheets with similar code, so I'd like to turn it into a macro. My only problem is that there are several variables. So at certain points the code looks like this:
Dim Msg_1 As String
Dim Msg_2 As String
Public Sub ListBox1_LostFocus()
ListBox1.Height = 15
With ListBox1
Msg1 = "'"
For i = 0 To .ListCount - 1
If .Selected(i) Then
Msg1 = Msg1 & .List(i) & "','"
End If
Next i
End With
Msg1 = Left(Msg1, Len(Msg1) - 2)
Sheets("Sheet1").Range("R3", "R3") = Msg1
End Sub
and so on. How can I pass in a new value for Msg1, Msg2, Msg3 for each worksheet?
I have trying this :
$string ="Group: ALL:ALL:Good";
@str2 = split (/:/,':',2);
print "@str2";
I am looking in $str[0] = Group and $str[1]= ALL:ALL:Good
It not working . What would be issue ?
The prototype of memset is void *memset(void *s, int c, size_t n);. So why the third parameter is of type size_t ? memset is just an example, I want more general reasons. Thanks in advance.
Given a base class
class A {
int i;
public:
int& f(){ return i;}
const int& f() const { return i;}
};
And a sub class
class ConstA : private A {
public:
const int& f() const { return A::f(); }
};
Is there a wrist-friendly way to access the ConstA::f method on a non-const variable?
ConstA ca;
int i = ca.f();
// compile error: int& A::f() is not accessible since A is privately inherited
int j = static_cast<const ConstA&>(ca).f();
// this works, but it hurts a little...
Or is it so ugly since hiding A::f generally is a bad idea, violating the Liskov Substitution Principle: any subclass of A must at least be capable of all A's functionality?
void set( A& a, int i ) { a.f() = i; }
class ConstA2 : public A {
private: int& f(){ return A::f(); }
};
ConstA2 ca2;
set( ca2, 1 );
(Note: this question popped up while thinking about this question)
Anyone know why this doesn't work?
var lastReceivedBeginDate = new Date($("input[name='lastReceivedFromYear']").val(),$("input[name='lastReceivedFromMonth']").val(),$("input[name='lastReceivedFromDay']").val(),$("input[name='lastReceivedFromHour']").val(),$("input[name='lastReceivedFromMinute']").val(),$("input[name='lastReceivedFromSecond']").val());
Thx
Hello all,
I am trying to place some html within a td that has an id but this doesn't seem to work. Can JQuery not put html in a td by using its id as a selector??
I do this:
$('#total_match').html("<b>Test</b>");
Here is the td:
<td id="total_match"></td>
No errors occur and nothing appears in the TD - I view the source to confirm.
I appreciate any help.
Hi all.. may i know the exact usage of getpriority() call used in linux.. even after searching thru net, i couldnt understand it exactly.. can someone explain it with an example.. thnx in advance :)
I've just switched my scripts to a different server. On the previous server this worked flawlessly, and now that I've switched them to a different server, I can't understand the problem.
I'm not sure it would help, but here's the relevant code.
$headers = apache_request_headers();
PHP Version is: PHP 5.3.2
Any help would be appreciated.
Hey everyone,
I have a pretty standard css layout where I use a container div that is 980px wide to hold everything. The only problem is that I want to have a 1900px wide banner half way down the page that is centered in the middle and is 100% width of the page. Is there any way to do this without getting rid of the container div?
so I am wanting
____________________
| | | |
| | | |
| | | |
|___| |___|
| |
| |
|___ ___|
| | | |
| | | |
| | | |
| | | |
|___|___________|___|
< 980px > container
< 100% page width >
Anyone know how to get that 1900px banner centered in the middle without deleting my container div?
THANKS!!
I need a html document, that contains multiple div's with 100% height (screen filling) one below the other.
I have tried to apply every element a height of 100%, but that won't work seamless nor clean.
Maybe there is a option with JavaScript? I don't have an idea.
Please suggest me your solutions.
chris