VSIP/formularium: verschil tussen versies

Uit Wina Examenwiki
Naar navigatie springen Naar zoeken springen
Regel 7: Regel 7:
  toewijzing :          :=
  toewijzing :          :=
  niet gelijk aan :    \=
  niet gelijk aan :    \=
  null:                Void        
  null:                Void
string:              STRING
int:                  INTEGER     


  if cond then C1 else C2 end
  if cond then C1 else C2 end


  class
  class
   MAIN                           -- de naam van je klasse
   NEWCLASS                           -- de naam van je klasse
  creation
  creation
   constructormethod                            -- constructoren aanduiden
   constructormethod                            -- constructoren aanduiden
  feature{}                          -- private other: feature{ANY}, feature{NAMECLASS}
feature{}                          --globale variabelen     
   constructormethod is
  name:STRING
  feature{}                          -- private other: feature{ANY}, feature{NAMECLASS1,NAMECLASS2}
   constructormethod is      
   do
   do
       io.put_string("hello world")  --do stuff
       io.put_string("hello world")  --do stuff
   end -- make
   end                               -- constructor
  end -- class MAIN
  end -- class MAIN



Versie van 10 dec 2008 11:01

Schrijf hier korte voorbeeldjes neer voor elke taal

Smalltalk

Eiffel

toewijzing :          :=
niet gelijk aan :     \=
null:                 Void  
string:               STRING
int:                  INTEGER       
if cond then C1 else C2 end
class
  NEWCLASS                            -- de naam van je klasse
creation
  constructormethod                            -- constructoren aanduiden
feature{}                           --globale variabelen      
  name:STRING
feature{}                          -- private other: feature{ANY}, feature{NAMECLASS1,NAMECLASS2}
  constructormethod is       
  do
     io.put_string("hello world")   --do stuff
  end                               -- constructor
end -- class MAIN

C++

C#

Getters en setters:

  • Mogelijkheid 1
private string foo;
public string Foo {
  get { return foo; }
  set { foo = value; }
}
  • Mogelijkheid 2 (C# 3.0+)
public string Foo { get; set; }