Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

Run specific code when overloading C++ operators -


i have class, let's call foo, contains 3 following methods (overloading left-associative < binary operator):

... operator<(a a) { return *this; } ... operator<(b b) { return *this; } ... operator<(c c) { return *this; } 

a, b, c classes not related in way(if that, of matter).

now in program have 2 following cases:

a = new a(); b b = new b(); c c = new c();  (first case): new foo() < < b; 

or

(second case): new foo() < < b < c; 

whenever have first case (which ends b), want execute function run() when have read(i know) b instance. idea have following code in foo class:

... operator<(b b) {     run(); } 

now when have code of first case, run() being executed.

the problem when have code in second case(which ends in c). want execute run() function again not until know c is. if have previous piece of code run() called when doing < b not want don't know c yet. if add run() in operator<(c c) call run() twice.

in few words want accomplish when having first case call run() @ operator<(b b) , when have second case call run @ operator<(c c).

any ideas on how can solved(if can)?

class prefoo { public:     prefoo() { ... }     prefoo & operator<<(a a) { ...; return *this; }     prefoo & operator<<(b b) { ...; return *this; }     prefoo & operator<<(c c) { ...; return *this; }      int aa, bb, cc; // save information };  prefoo makefoo() { return prefoo(); }  class foo { public:     foo(const prefoo & pre) { run(); } // implicit conversion      void run() {} // run!! };   void g() {   a; b b; c c;   // implicit conversion @ end   foo foo1 = makefoo() << << b;   foo foo2 = prefoo() << << b << c; } 

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -