Politechnika Śląska - strona 308

note /search

MS-DOS - opracowanie

  • Politechnika Śląska
  • Systemy operacyjne
Pobrań: 7
Wyświetleń: 525

MS-DOS W systemie operacyjnym MS-DOS proces przy starcie może zarezerwować pewną ilość tzw. segmentów pamięci operacyjnej położonej poniżej adresu 655360. W trakcie życia może zarezerwować dodatkowe segmenty lub zwolnić je. Może też rezerwować i zw...

Class in programming

  • Politechnika Śląska
  • Computer Programming
Pobrań: 0
Wyświetleń: 448

Class in programming  Class in programming — generalized type defined by the programmer  used for defining objects (generalized variables)  provides programmer with new possibilities  a class should clearly represent specific concept, idea, or real-life being, that has not been yet described by...

Class members access rules

  • Politechnika Śląska
  • Computer Programming
Pobrań: 0
Wyświetleń: 483

Class members access rules  private: private members accessible for methods of this class, for methods and functions declared as friends In a class, all members are private by default  public: public members accessible from outside the class In a struct, all members are public by default  protec...

Classes and Abstract Data Types

  • Politechnika Śląska
  • Computer Programming
Pobrań: 0
Wyświetleń: 329

Classes and Abstract Data Types  classes are suitable for implementing Abstract Data Types  classes are Abstract Data Types  We define an interface - we do not care how the methods are implemented - details are separated from the class interface (hermetization)  Examples - stack, queue, point, ...

Const and pointers

  • Politechnika Śląska
  • Computer Programming
Pobrań: 0
Wyświetleń: 504

const and pointers  pointer to const: const char *pc=”asdf” (or: char const *pc=”asdf”)  const pointer: char * const cp=”asdcf”;  const pointer to const: const char * const cpc=”asdcf”;  mistakes: pc[1]='2'; cp++; cpc[1]='b'; cpc--;  it is co...

Const

  • Politechnika Śląska
  • Computer Programming
Pobrań: 0
Wyświetleń: 546

Const  named constants - replace #defined C constants const five = 5; void foo(const int con_i);  consts - regular variables, with address, size, operators, but not to be modified  const prevents programmer from mistakes  use of consts permits optimization by a compiler ...

Constructing and destructing dynamic objects

  • Politechnika Śląska
  • Computer Programming
Pobrań: 0
Wyświetleń: 266

Constructing and destructing dynamic objects point *pp0=new point; point *pp1=new point(1.0); point *pp2=new point(10.0, 20.0); point *arrPoints=new point[10]; // array of 10 points // initialized with the default constructor // in order of increasing addresses // new T[] - calls only the default c...

Defining

  • Politechnika Śląska
  • Computer Programming
Pobrań: 0
Wyświetleń: 497

Defining class point { double x, y; public: // … point(double, double); point(double); point() { x = y = 0.0; }; }; inline point::point(double d) { x = y = d; } point::point(double x0, double y0) { x = x0; y = y0; } ...

Destructor - Example

  • Politechnika Śląska
  • Computer Programming
Pobrań: 0
Wyświetleń: 490

Destructor  Called when the object is destroyed  Necessary if something should be done at this timepoint  Destructor for the class T: ~T();  Example ~point() // no args, no returned value ...

Example of default function argument

  • Politechnika Śląska
  • Computer Programming
Pobrań: 0
Wyświetleń: 371

Default function arguments int fun(int i1, int i2=20, int i3=30);  starting from the first default argument, all remaining also have to be default  function with default arguments is not overloaded, &fun(int) == &fun(int, int)  we may overload: int fun(int i1, int i2); // declaration is ...