CrazyEngineers Forum |
- Object Oriented PHP!!
- Change the past
- RLC Series Circuit
- Virtual 8085 - My project
- Your comments are welcome On VoiCE
- concrete bridge without reinforcement
- using CE id
- Mechanical software
- NorthEye Noida - Construction Discussion
- Infy's Mohandas Pai Says Don't Expect Huge Wage Hike
- Pre-order Nintendo 3DS accessories?
- AJAXifying the shoutbox
Posted: 04 Mar 2011 02:26 PM PST Hi Ceans, Here I am with another tutorial and as requested by goyal hope you guys get benefited by this.... NOTE: This tutorial is copyrighted to CE as its my own work!! :p Before getting into OO programming we have to know what are the basic features available in object oriented programming. So lets begin with features in OO programming. following is the list of important features when it comes to OO programming: NOTE: I know you guys already read and know about it but still I thought may be I can add my thought and understanding on these features :) Objects: It's a real time entity it can be a name, person or a place. technically speaking its defined as the instance of a class. Class: Collection of similar objects together is called a class. Inheritance: The ability of a program to be reused basically re-usability of code, which is once written and can be used again and again Polymorphism: The ability of a program or a function which can act differently at different instances. NOTE: The above features holds fine for all the programming languages which supports object orient programming ;) Let's start by defining a class in PHP.... In order to define a class in php we have to use the keyword class, a typical class structure will be as shown below: class class_name { var variable1; function functionname(argument list) { //Some commands } } Looks simple right!! yes it is easy ok now lets try something interesting... using class in php. I am going to define a class named crazyengineers and define a variable and then define two functions within the class so lets do it, <?php class crazyengineers { var $name; function Greet() { echo "Welcome to CE!!"; } function Pride() { echo "Be proud to be a CEAN :)"; } } ?> Ok So what we have done is... we have defined a class named crazyengineers using the keyword class and I have defined a variable named $name which does not hold any value (just a variable declaration) and then I have defined two functions Greet() and Pride() which is going to display the message "Welcome to CE!!" and Be proud to be a CEAN :) " respectively. if you probably execute the above code you will not get any output because we have just defined a class with two function but we have not called it any where in the program, so unless we call the function its not gonna do the command what we want it to do... So in order to access the elements ($name, Greet() and Pride() are the elements of the class crazzyengineers) in a class we require an object so lets create one. In order to create a object in class we use the keyword new followed by the class name, following is the object for the class crazyengineers: $ceobject = new crazyengineers; So I have created an object named $ceobject for the class called crazyengineers . That's it!! now how can we use the object to access the class methods or variables?? that's again easy Lets see how to do it for instance I wanna access the variable $name then I have to do something like this, $ceobject->name; Yeap the object name followed by the -> operator and the variable name with out the prefix '$' will allow you to access the variable $name in the class crazyengineers using its object $ceobject. Ok how can I assign a value to that variable using an class object?? simple... $ceobject->name='slashfear'; Now I have assigned a value slashfear for the variable named $name which is in the class crazyengineers. Accessing the function in the class works the same way, $ceobject->Greet(); $ceobject->Pride(); Now lets complete our code: <?php class crazyengineers { var $name; function Greet() { echo "Welcome to CE!!"; } function Pride() { echo "Be proud to be a CEAN :)"; } } $ceobject = new crazyengineers; $ceobject->name = 'slashfear'; echo "Hi " . $ceobject->name; echo "<br>"; $ceobject->Greet(); echo "<br>"; $ceobject->Pride(); ?> It's done!! Output of the above program will be as shown below: Hi slashfear Welcome to CE!! Be proud to be a CEAN :) I guess you guys understood about the basics of class and objects in PHP. If you have any doubts please feel free to ask!! Love to solve you doubts and also post in your feedback's (I have spent time in writing this tutorial for you guys!!) -Arvind |
Posted: 04 Mar 2011 01:33 PM PST If you are given a chance to change a single situation of you from the past. What situation would it be??? and why you choose that??? |
Posted: 04 Mar 2011 01:07 PM PST Guys, Let's suppose we have a RLC series circuit feeded by tension source initially with no energy stored. When we apply an unitary step of tension at t=0 at the terminals of the circuit, we observe a current of i(t)=(125/24) * exp(-700t)* Sin(2400t) mA that goes around the circuit for t>0s. I want to find the values of R, L, C. I was trying to match the laplace transformation of the current above to the laplace transformation of the circuit for the current but no success. |
Posted: 04 Mar 2011 09:27 AM PST Just thought of creating a new thread here to showcase my project. Hope you will find it useful. Just an introduction here, Virtual 8085 is an interpreter for the 8085 assembly language. You can practice the 8085 programs which you learn in college on Virtual 8085. This will help you learn and understand assembly language programming more better. Moreover this is an open source project published under the new BSD licence. So if you have it in you, then head over to contribute and make Virtual 8085 even better. Virtual 8085 page at Codeplex Virtual 8085 blog |
Your comments are welcome On VoiCE Posted: 04 Mar 2011 04:19 AM PST CEans, Our VoiCE authors have been contributing great articles, tips and knowledge on VoiCE -our official blog. I'm sure many of you are regular readers of VoiCE. It would be nice if you leave your comments on our posts so that we know how we are doing. :) |
concrete bridge without reinforcement Posted: 04 Mar 2011 03:57 AM PST hi everyone, This is chetan. As many of you might know that, in 2015 UK government will be spending 75% on maintenance of old bridges and only 25% on building new bridges, and this is because of rusting of steel.:mad: So need of hour is to develop something like old masonry bridges made up of stones and bricks which are still in position, and having almost negligible maintenance cost as compared to steel and concrete bridges. And in India we are building average 23 bridges everyday on highways.:o I am researching on possibility of building bridge without any kind of reinforcement. I mean bridge building just with concrete , NO RCC.;) So just wanted to know if anyone is interested in same topic to research on, is most welcome, please do contact me on archbridgebuilder@gmail.com kind regards chetan |
Posted: 04 Mar 2011 03:36 AM PST hey friends, we are much bothered about having the experts here then why cant we use CE id in many official sites many are giving there gmail id's we CEans why cant we give the CE id's instead of gmail id's i think this will be as indirect publicity and many will know about CE by that i had just got this idea when my english lab faculty asked us for our id's and i implemented by giving my CE id |
Posted: 04 Mar 2011 03:34 AM PST Hi all, I wanted to discuss what similarities you find between various softwares like catia,mechanical,inventor,Gstar etc. I use or atleast have worked with PRO-E and Catia and I can tell you that use of both is nearly same but you can do styling and surfacing with catia more easily. |
NorthEye Noida - Construction Discussion Posted: 03 Mar 2011 11:50 PM PST I got introduced to Northeye construction project at Noida India via CB's post in Skyscrappers. I checked out the video on SUPERTECH: NORTH EYE and its impressive. Does anyone have any details about the project? The height and other relevant details? |
Infy's Mohandas Pai Says Don't Expect Huge Wage Hike Posted: 03 Mar 2011 09:16 PM PST INFI's Mohandas Pai has said that the good old days of wage increase are over and IT engineers shouldn't expect huge salary raises this year. The reason is that market has become too competitive and there's increasing unemployment in the US and UK. Indian IT industry being mostly services oriented, depends largly on the markets in the US and UK. He said that the wage increase would be a single digit number on the higher side (7-9 percent?) Mohandas Pai said that he expects fair stabilization in fresh engineering graduate salary over the next four years as the supply is growing at a faster rate than the demand. Source: Days of huge wage increases are over: Infosys' T V Mohandas Pai - Business news Thanks to mushrooming Indian engineering colleges that produce engineers in bulk. I think ultimately, the industry will suffer. What's your take? |
Pre-order Nintendo 3DS accessories? Posted: 03 Mar 2011 08:26 PM PST I pre-ordered the Nintendo 3DS, and now I’m ordering in 3DS accessories. |
Posted: 03 Mar 2011 03:34 PM PST Hey Admins, We have that conference / shoutbox in the home page of the forum. It is using a continuous refresh method, which is browser and bandwidth intensive. Why don't we think of using an AJAX Shoutbox, instead of refresh SB? We can move on to Web 2.0 Technologies na? :p Waiting for your approval to work on it... :p |
You are subscribed to email updates from CrazyEngineers Forum To stop receiving these emails, you may unsubscribe now. | Email delivery powered by Google |
Google Inc., 20 West Kinzie, Chicago IL USA 60610 |
No comments:
Post a Comment