Forum » Programiranje » Iščem program c++
Iščem program c++
kratos ::
Lep pozdrav
Torej iščem nek program v c++, ki bi imel dedovanje v razredih
class (kakršnkoli program). Bi bil zelo hvaležen če ima kdo tak program doma na računalniku ali če ga je kdo nahitro pripravljen spisati (ali link od kakšne strani ker sam nisem nikjer zasledil tega). Hvala lepa za vso pomoč :).
Torej iščem nek program v c++, ki bi imel dedovanje v razredih
class (kakršnkoli program). Bi bil zelo hvaležen če ima kdo tak program doma na računalniku ali če ga je kdo nahitro pripravljen spisati (ali link od kakšne strani ker sam nisem nikjer zasledil tega). Hvala lepa za vso pomoč :).
kratos ::
evo sem našel program, vendar ta ni popoln jaz pa potrebujem popolnega.
class vehicle //Sample base class for c++ inheritance tutorial
{
protected:
char colorname[20];
int number_of_wheels;
public:
vehicle();
~vehicle();
void start();
void stop();
void run();
};
class Car: public vehicle //Sample derived class for C++ inheritance tutorial
{
protected:
char type_of_fuel;
public:
Car();
};
class vehicle //Sample base class for c++ inheritance tutorial
{
protected:
char colorname[20];
int number_of_wheels;
public:
vehicle();
~vehicle();
void start();
void stop();
void run();
};
class Car: public vehicle //Sample derived class for C++ inheritance tutorial
{
protected:
char type_of_fuel;
public:
Car();
};
c0dehunter ::
Samo header fajla:
#ifndef PRENOCISCE_H #define PRENOCISCE_H #include <iostream> using namespace std; class Prenocisce{ protected: int cena; bool wifi; public: Prenocisce(); Prenocisce(int c, bool wf); virtual void izpis(); virtual int izracunaj_ceno()=0; }; #endif #ifndef SOBA_H #define SOBA_H #include "Prenocisce.h" class Soba: public Prenocisce{ private: int st_oseb; public: Soba(); Soba(int c, bool wf, int st_o); void izpis(); int izracunaj_ceno(); }; #endif
I do not agree with what you have to say,
but I'll defend to the death your right to say it.
but I'll defend to the death your right to say it.
kratos ::
Bi bla kakšna dobra duša in bi mi dokončala tale program ?
ker to je sam en delček programa.
class vehicle
{
protected:
char colorname[20];
int number_of_wheels;
public:
vehicle();
~vehicle();
void start();
void stop();
void run();
};
class Car: public vehicle //Sample derived class for C++ inheritance tutorial
{
protected:
char type_of_fuel;
public:
Car();
};
Hvala.
ker to je sam en delček programa.
class vehicle
{
protected:
char colorname[20];
int number_of_wheels;
public:
vehicle();
~vehicle();
void start();
void stop();
void run();
};
class Car: public vehicle //Sample derived class for C++ inheritance tutorial
{
protected:
char type_of_fuel;
public:
Car();
};
Hvala.
krneki0001 ::
Sicer je napisano v ruby-ju, ampak če si malo programerja, boš vedel kako to prestavit v C++.
rekurzija - rekurzivni klic
dedovanje
rekurzija - rekurzivni klic
$zunanji_stevec = 0 def rekurzija( cifra ) cifra += 1 $zunanji_stevec +=1 puts( "cifra: #{cifra}, $zunanji_stevec: #{$zunanji_stevec}" ) if $zunanji_stevec < 3 then rekurzija( cifra ) #<= rekurzivni klic metode rekurzija end puts( "Konec: cifra: #{cifra}, zunanji_stevec: #{$zunanji_stevec}" ) end rekurzija( 0 ) #Klic metode rekurzija
dedovanje
class One end class Two < One end class Three < Two end ob = Three.new x = ob.class puts( x ) begin x = x.superclass puts(x) end until x == nil
Vredno ogleda ...
Tema | Ogledi | Zadnje sporočilo | |
---|---|---|---|
Tema | Ogledi | Zadnje sporočilo | |
» | [C++] Dedovanje, virtualne in abstraktne metodeOddelek: Programiranje | 2967 (2766) | mallard |
» | [JAVA] zaustavitev niti (threadov)Oddelek: Programiranje | 3175 (3175) | morbo |
» | [C++] Linker errorOddelek: Programiranje | 1286 (1286) | Quikee |
» | [C++] Problem z dedovanjem šablon (template inhieritance)Oddelek: Programiranje | 1653 (1531) | Gundolf |
» | [c++] prekrivanje konstruktorjevOddelek: Programiranje | 1963 (1778) | zavger |