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.

c++ - How to exchange data between classes? -


i'm learning c++ , moving project c c++. in process, stumbled on problem: how save/update variables in use in several classes? in c used global variables, not c++.

so, let's assume have 4 classes:

class main_window {     //...     void load_data_menu_selected(); }  class data {     //...     double *data; }  class load_data {     //...     double *get_filename_and_load(); }  class calculate {     //...     int do_calculation() } 

so, main_window class application's main window interacts user input etc.
want do:

  • create instance of class data in main_window
  • use load_data loading data file , store in data
  • use calculation class doing read data in data class
  • the question is: should create classes, make data class members available other classes. should use inheritance?

    start observing possible relations between instances of 2 classes. let a instance of class , b instance of class b. if a uses b, class can have member instance of class b (b), pointer b (which of type b*), or reference of b (which of type b&). if 1 method of class uses b, have again same 3 options: b, b* or b& can method's arguments. having b* , b& class members suggests a not control b's lifetime class must have method sets these members through parameters. question of ownership (objects' lifetimes) has big role in design of relationship between classes. main relationships briefly described in article.


    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 -