LEAP 71 | PicoGK.org Blog
Now, before we copy and paste our code there, we need to understand one more concept, the concept of namespaces. In the old days of programming, every symbol you defined was global. If I called a variable fResultand someone else called another variable the same, this would lead to all sorts of interesting problems. Organizing data in classes, and hiding information helped a lot, but still you and I may both create a class called Car and the names would clash. So, people started adding project-specific prefixes and performed all kinds of tricks, in order to prevent this. Soon function names started to look like your cat accidentally walked over your keyboard during coding. If you see some of these names, you know they come from a bygone era. Take a name like this one from the Apple API: NSAttributedStringEnumerationOptions — the NS prefix tells us, it has its origins in the NeXTSTEP programming environment, which was introduced when Steve Jobs, freshly kicked out of Apple, started his n
LEAP 71 | PicoGK.org Blog LEAP 71 PicoGK.org /coding for engineers Table of contents Classes Let’s revisit the concept of classes we introduced in the first part of our series. Here’s our final class definition from before. public class TeslaRoadster { public TeslaRoadster ( string strName = "Poor anonymous car" , uint nPercentFull = 0 ) { m_fBatteryLevel = nPercentFull / 100.0f ; m_strName = strName ; } public void Charge () { m_fBatteryLevel = 1 ; m_nChargingCycles = m_nChargingCycles + 1 ; } public string strName () { return m_strName ; } public uint nBatteryLevelPercent () { return Convert
Explore this link on the map →saved by
related reading
- LEAP 71 | PicoGK.org Blogpicogk.org
- LEAP 71 | PicoGK.org Blogpicogk.org
- LEAP 71 | PicoGK.org Blogpicogk.org
- LEAP 71 | PicoGK.org Blogpicogk.org
- 9. Classes — Python 3.14.6 documentationdocs.python.org
- how I think when I think about programming - alice mazalicemaz.com
- CS106B Object-Oriented Programmingweb.stanford.edu
- 14.1 — Introduction to object-oriented programming – Learn C++learncpp.com
- Classes - JavaScript | MDNdeveloper.mozilla.org
- Object-oriented programming - Learn web development | MDNdeveloper.mozilla.org
- 4. Encapsulation - CS2030S Programming Methodology IInus-cs2030s.github.io
- Defining Classesdeveloper.apple.com