/srv/irclogs.ubuntu.com/2010/06/25/#ubuntu-classroom.txt

=== ZachK_ is now known as zkriesse
wesleydoes anyone know if this is where the july 10th user day will be held?01:43
wesleyis anyone in here?01:44
zkriessewesley: hello01:45
zkriessewesley: Yes it will be held here01:45
wesleyzkriesse thanks is there anything I can do to help on july 10th?01:46
zkriessewesley: well what do you know01:46
Pendulumwesley: if you'd like to help out, feel free to join #ubuntu-classroom-backstage and chat with us there01:49
Pendulumthis channel is really meant for holding classes only01:49
zkriessehello Nicke02:40
zkriessewelcome userdays502:41
=== yofel_ is now known as yofel
=== bgs100 is now known as bgs000
userdays8jn08:17
ronaldo_hello why i after downloading adobe flash...it cannot install here10:47
=== ghostcube_ is now known as ghostcube
=== bgs000 is now known as bgs100
=== virtuald_ is now known as virtuald
=== yofel_ is now known as yofel
sirmacikHi all! Time for third part of C# introduction20:59
sirmacik(;21:00
=== ChanServ changed the topic of #ubuntu-classroom to: Welcome to the Ubuntu Classroom - http://wiki.ubuntu.com/Classroom || Support in #ubuntu || Current Class: Introduction to C# Day 3
pleia2juju2143: around?21:03
pedro3005oh darn?21:06
pleia2just messaged him, hopefully he'll show up :)21:06
pedro3005pleia2, well, he was last seen 71 minutes ago21:11
sirmacik:/21:14
pleia2pedro3005: do you know anyone who has other ways to contact him?21:14
pedro3005pleia2, unfortunately, no21:14
pleia2alright, I think we've done all we can, hopefully he'll see my /msg or remember soon21:14
pedro3005yeah, he won't pick up skype either21:15
juju2143oh im there21:19
pleia2woohoo :)21:20
juju2143I had to leave unexpectly21:20
sirmacik\o/21:20
juju2143everyone's ready?21:20
juju2143Good.21:20
sirmacikmonodevelop opened (;21:20
juju2143me too21:21
juju2143We will do classes21:22
pedro3005yeah, I have it here21:22
juju2143OOP.21:22
juju2143So open your console project21:23
pedro3005a new one?21:24
sirmacikopened21:24
pedro3005I'm afraid I don't have the old one anymore :P21:24
juju2143whatever21:24
juju2143it doesn't matter.21:24
pedro3005ok21:24
juju2143So you have your Main function21:25
juju2143your Mainclass21:26
sirmacikyep21:26
juju2143So imagine a class as an object. In fact it is an object.21:27
juju2143So for example, a person.21:27
juju2143So we will make a person class.21:28
juju2143A person have a name, a sex, etc., it can walk, run, etc.21:29
juju2143So the name and the sex is attributes21:30
juju2143and the fact he can walk and run are methods.21:30
juju2143So we'll start with that.21:30
juju2143So what you can write between the penultimate and ultimate } of your file is:21:31
juju2143class Person21:31
juju2143{21:31
juju2143// Insert here attributes21:32
juju2143// Insert here methods21:32
juju2143}21:32
juju2143Now for attributes you can have:21:33
juju2143<public/private> <type> <name of variable>[ = <initial value>]21:34
juju2143;21:34
pedro3005public is like 'global', and private is like 'local'?21:35
juju2143yes21:37
juju2143public you can access it outside your class21:37
juju2143private, you can't21:37
pedro3005Ok21:37
juju2143and protected, hm it have something to do with inheritance.21:38
juju2143you can also add static, so you can access it outside your class and without initialize it21:39
juju2143like you have public static something;21:39
juju2143you can do Person.sonething without initialize a variable of type Person before21:40
juju2143and also there is properties21:40
juju2143like this:21:41
juju2143public Property21:41
juju2143{21:41
juju2143set21:42
juju2143{21:42
juju2143/ do something when Property is set21:42
juju2143}21:42
juju2143get21:42
juju2143{21:42
juju2143// do something when Property is accessed21:43
juju2143}21:43
juju2143}21:43
pedro3005juju2143, so the difference is static wouldn't have the arguments received upon instanciation?21:48
sirmacikhmm21:56
sirmacikjuju2143: can we move on somewhere?21:57
pedro3005juju2143, ?22:18
sirmacik-_22:21
sirmacik-22:21
juju2143oh22:22
juju2143back, I had to go22:23
juju2143like, you know parents, "Leave your computer RIGHT NOW"22:23
juju2143so, pedro3005, yeah something like that.22:25
pedro3005juju2143, ok, I was trying to make something and it didn't go very well22:25
juju2143ok...22:25
juju2143so back to our Person example22:26
pedro3005juju2143, http://paste.pocoo.org/show/229992/22:26
pedro3005wait22:26
pedro3005fail22:26
pedro3005okay, changing "Person.isMale()" to "a.isMale()", I get: "The member `Classes.Person.isMale' cannot be used as method or delegate(CS1955)"22:27
juju2143pedro3005, line 11, since it acts like an attribute, you don't need the ()'s22:27
pedro3005okay, it works22:28
pedro3005:)22:28
pedro3005go on, sorry22:28
juju2143but the rest, it's an perfect example of a class.22:28
juju2143you did the return right22:29
juju2143and in the set clause, you can do value = something22:29
juju2143instead of ismale22:29
juju2143pedro3005, also instead of a int you would use a bool22:29
juju2143return true; or return false;22:30
pedro3005juju2143, yeah I just wanted to make a method :)22:30
juju2143ok22:30
juju2143so properties are like a blend between method and attributes22:31
juju2143also, see the Person a = new Person (); line?22:31
juju2143maybe you want to pass arguments22:32
pedro3005yeah, but how?22:32
juju2143so in your class you need a method of the same name as the class22:32
juju2143Person(string arg)22:33
juju2143{22:33
juju2143//do something, like put the arg in attributes)22:33
juju2143}22:33
pedro3005shouldn't it have public/private and type?22:33
juju2143this is a constructor.22:33
juju2143pedro3005, nope22:33
juju2143no public/private or type22:33
pedro3005Person (string arg)22:35
pedro3005private string sex = arg;22:35
pedro3005this doesn't work, it complains about "private"22:35
AKShamsHello22:37
juju2143pedro3005, hmmm22:37
juju2143hi AKShams22:37
juju2143pedro3005, that's because you are inside a method22:38
juju2143inside you don't need private22:38
AKShamscould you tell me when the Classes take place, it's not listed in the wiki page?22:38
pedro3005juju2143, but then I can't access inside the isMale method22:39
pedro3005AKShams, right now22:39
AKShamsso, what's going on I'm new!22:39
pedro3005We're learning about classes ;)22:40
AKShamshhhhhhhhh22:40
AKShamswill someone give a lecture or something like that?22:40
pedro3005juju2143 is teaching22:40
juju2143yep.22:40
sirmacikAKShams: look at logs22:41
AKShamsso, what is the subject?22:41
juju2143pedro3005, hm what you have now for code?22:41
AKShamsik22:41
sirmacikC# introduction22:41
AKShamsok22:41
juju2143yep C#22:41
AKShamsGREAT :D22:41
pedro3005juju2143, http://paste.pocoo.org/show/230008/22:41
AKShamsthnx22:42
pedro3005wouldn't you need something like Python's "self" or PHP's $this?22:42
juju2143oh that's because you are declaring a variable in a function and accessing it in another function22:43
AKShamsYes ofcourse22:43
juju2143it won't work22:43
pedro3005juju2143, I know, but what's the solution?22:43
juju2143also, there is a this22:43
juju2143pedro3005, declaring sex outside methods, but inside your class22:44
juju2143and with the private.22:44
pedro3005juju2143, still not working http://paste.pocoo.org/show/230011/  (protection level error)22:45
juju2143what?22:48
juju2143which line is the error?22:48
pedro3005juju2143, 922:49
pedro3005[Task:File=/home/pedro/Projects/Classes/Classes/Main.cs, Line=9, Column=55, Type=Error, Priority=Normal, Description=`Classes.Person.Person(string)' is inaccessible due to its protection level(CS0122)]22:49
juju2143okkk22:50
juju2143right. I forgot.22:51
juju2143Put a public in front of the constructor.22:51
pedro3005now it runs :)22:53
juju2143:)22:54
pedro3005go on22:55
juju2143ok22:55
juju2143So. you can make attributes, methods and properties.22:56
juju2143So, this is basic OOP­.22:58
juju2143Monday, more advanced OOP.22:58
juju2143Inheritance.22:58
juju2143Have questions?22:58
pedro3005juju2143, one question. have you taught arrays?22:58
juju2143yes22:58
juju2143DAy 122:58
pedro3005really? I must've forgotten then22:59
juju2143seen the string[] args in the Main args? I told about that in Day 122:59
juju2143also this channel is logged.22:59
AKShamswhere to find the logs?23:00
juju2143AKShams, look at the topic23:00
pleia2irclogs.ubuntu.com23:00
pleia2juju2143: added day 4 to the calendar for Monday23:01
juju2143pleia2, k thx.23:05
pedro3005pleia2, hm, I think it's broken... http://irclogs.ubuntu.com/2010/06/22/%23ubuntu-classroom.html23:05
pleia2pedro3005: the classes started on the 23rd, not the 22nd23:08
pleia2so you want this for day one: http://irclogs.ubuntu.com/2010/06/23/%23ubuntu-classroom.html23:09
pedro3005pleia2, quiet day, that was23:09
pedro3005:P23:09
pleia2yeah, we don't have classes every day23:09
=== ChanServ changed the topic of #ubuntu-classroom to: Welcome to the Ubuntu Classroom - http://wiki.ubuntu.com/Classroom || Support in #ubuntu || Upcoming Schedule: http://is.gd/8rtIi

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!