Re: [Vala] Inheritance and construct



Hi Arley,

2009/5/25 Arley Consuegra Rosello <aconsuegra estudiantes uci cu>
I'm have a problem with de inheritance and the constructors.
In c++ the inheritance loosks like

class padre{
protected:
int a,b,c;
public:
padre(int pa,int pb,int pc){
a=pa;
b=pb;
c=pc;
                          }
          }

This is the definition of Padre that you need:

public class Padre {
  protected int a;
  protected int b;
  protected int c;

  public Padre (int pa, int pb, int pc) {
    a = pa;
    b = pb;
    c = pc;
  }
}

class hija: public padre{
private:
int d;
public:
hija(int pa,int pb,int pc,int pd):padre(pa,pb,pc){
d=pd;
                                         }
                          }

And for Hija:

public class Hija: Padre {
  private int d;

  public Hija (int pa, int pb, int pc, int pd)
  {
    base (pa, pb, pc);
    d = pd;
  }
}

The sintax of Vala is derived from C#, so the basic concepts come from C#.


but in Vala I read de examples and don't find how to some thing like this.

Look here http://live.gnome.org/Vala/Tutorial#head-1ea7607e7c44ee7c0354c8580848412e06b109e2
 
_______________________________________________
Vala-list mailing list
Vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list

 
Matias


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]